Compiler Error CS5001

Program 'program' does not contain a static 'Main' method suitable for an entry point

This error occurs when no static Main method with a correct signature is found in the code that produces an executable file. This error also occurs if the entry point function, Main, is defined with the wrong case, such as lower-case main.

  • Main must be declared as static and it must return void or int, and it must have either no parameters or else one parameter of type string[].

Example

The following example generates CS5001:

// CS5001.cs
// CS5001 expected
public class a
{
   // Uncomment the following line to resolve.
   // static void Main() {}
}

See Also

Concepts

Main() and Command-Line Arguments (C# Programming Guide)