Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0017 

Error Message

Program 'output file name' has more than one entry point defined: function

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
public class clx
{
   static public void Main()
   {
   }
}

public class cly
{
   public static void Main()   // CS0017, delete one Main or use /main
   {
   }
}

Community Additions

ADD
Show:
© 2015 Microsoft