【发布时间】:2017-09-07 23:33:23
【问题描述】:
我正在使用dotnet 从命令行构建一个 .NET Core C# 项目。该项目有多个具有main 方法的类。因此我得到了错误:
$ dotnet build
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
Test.cs(18,28): error CS0017: Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.
Build FAILED.
传递/main 开关会导致错误:
$ dotnet build /main:Test
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1001: Unknown switch.
Switch: /main:Test
如何将/main 开关传递给dotnet 命令?
【问题讨论】: