Lost refernce to Main: "does not have an entry point defined"

D

Dave

This morning I copied a C# console project file I was working on over the
week-end to my workstation and tried to run it. I got the message:

Program 'C:\Visual Studio\myProj.exe' does not have an entry point defined

My code looks like this:

using System;
using System.Reflection;

namespace myProj
{
public class Class1
{
public static int Main(string[] args)
{
try
{
.....
}}}

So I went to Project Properties|Common properties|General, and set the
Startup object to the name of the class (Class1)

Now I get the message:

Could not find 'Class1' specified for Main method

What would cause my project to lose a reference to Main? How can I fix it?
 
R

Richard Blewett [DevelopMentor]

Check in the solution explorer that the file containing Class1 has its "Build action" property set to "compile" - you may have inadvertently removed it from the build process

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

This morning I copied a C# console project file I was working on over the
week-end to my workstation and tried to run it. I got the message:

Program 'C:\Visual Studio\myProj.exe' does not have an entry point defined
 
D

Dave

Thanks Richard

Its build action was set to "embedded resource." I'm not sure how that
happend, I just copied the files from one machine to another.

Any way, I know what to look for now.

Thank you for your help.
Dave



Richard Blewett said:
Check in the solution explorer that the file containing Class1 has its
"Build action" property set to "compile" - you may have inadvertently
removed it from the build process
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top