'dotnet build' specify main method

后端 未结 2 1776
臣服心动
臣服心动 2020-12-16 12:09

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:

2条回答
  •  一整个雨季
    2020-12-16 12:35

    You can edit your csproj to define which class to use (inside a PropertyGroup):

    foo.Program2
    

    or specify this MSBuild property on the command line via:

    $ dotnet build foo.csproj /p:StartupObject=foo.Program2
    

提交回复
热议问题