7
我使用dotnet
从命令行构建.NET Core C#项目。该项目有一个main
方法的多个类。因此,我得到的错误:dotnet构建指定主要方法
$ 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
命令?
贸易的尼斯把戏! – granadaCoder
我花了一个小时尝试几件事,直到找到答案。非常感谢您花时间记录这些! – koopajah