I am using dotnet to build a .NET Core C# project from the command line. The project has multiple classes with a main method. Thus I get the error:
dotnet
main
You can edit your csproj to define which class to use (inside a PropertyGroup):
PropertyGroup
foo.Program2
or specify this MSBuild property on the command line via:
$ dotnet build foo.csproj /p:StartupObject=foo.Program2