Compiler Error CS0017
Program 'output file name' has more than one entry point defined. Compile with /main to specify the type that contains the entry point.
A program can only have one Main method.
To resolve this error, you can either delete all Main methods in your code, except one, or you can use the /main compiler option to specify which Main method you want to use.
The following sample generates CS0017:
// CS0017.cs
// compile with: /target:exe
public class clx
{
static public void Main()
{
}
}
public class cly
{
public static void Main() // CS0017, delete one Main or use /main
{
}
}
Solution for those using MS Visual Studio
If you are using MS Visual Studio and do not want to delete the other Main() methods you can specify the class which you want as you Entry Point in Startup Object in the Project Properties under Application Tab ( atleast for VS2008 Express)
- 2/8/2008
- codingnoobie