Access to this page requires authorization. You can try
.
Access to this page requires authorization. You can try
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. It also occurs if the entry point function,
Main
, is defined with the wrong case, such as lower-case
main
. For information about the rules that apply to the
Main
method, see
Main() and Command-Line Arguments
.
If the
Main
method has an
async
modifier, make sure that the
selected C# language version
is 7.1 or higher and to use
Task
or
Task<int>
as the return type.
The
Main
method is only required when compiling an executable file, that is, when the
exe
or
winexe
element of the
TargetType
compiler option is specified. The following Visual Studio project types specify one of these options by default:
Console application
ASP.NET Core application
WPF application
Windows Forms application
Example
The following example generates CS5001:
// CS5001.cs
// CS5001 expected when compiled with -target:exe or -target:winexe
public class Program
// Uncomment the following line to resolve.
// static void Main() {}