[.net] does not contain a static 'Main' method
Error:
error CS5001: Program 'c:\MyProject\MyProject\Program.exe' does not contain a static 'Main' method suitable for an entry point
Can somebody clarify this error for me please? And also how to go about remedying the problem.
Thanks,
L-
All programs need an entry point, in this case a Main() function (that is static).
You didn't specify the language you're using (I'm guessing c#...?), but look up any beginner tutorial for your language and it should cover Main().
You didn't specify the language you're using (I'm guessing c#...?), but look up any beginner tutorial for your language and it should cover Main().
I understand that I need a Main, but what if I'm just writing a library, a DLL, then how do I specify that I don't need, or want, a public void static Main() method?
If I just set the output type to 'library' should that take care of this problem or do I have to specify via some attribute?
L-
If I just set the output type to 'library' should that take care of this problem or do I have to specify via some attribute?
L-
Quote:Original post by Lucidquiet
I understand that I need a Main, but what if I'm just writing a library, a DLL, then how do I specify that I don't need, or want, a public void static Main() method?
If I just set the output type to 'library' should that take care of this problem or do I have to specify via some attribute?
L-
Setting the output type to class library (or is it just 'library'?) should do the trick, yes.
If your using some Visual Studio variant when creating a project just select Library or DLL or whatever the option is called, that should fix your problem :).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement