【发布时间】:2017-11-05 00:10:19
【问题描述】:
我正在创建一个需要单元测试的应用程序。我正在使用 .NET xUnit 框架。
首先,我用
初始化了一个新的“Hello, World!类”dotnet new console
然后我添加了单元测试
dotnet new xunit
当我运行 dotnet run 或 dotnet test 时,我收到此错误:
error CS0017: Program has more than one entry point defined. Compile with /main to specify the type thatcontains the entry point.
我读到 xUnit 中定义了一个 Main ,它会干扰 Program 中的入口点,但我如何才能将它们分开?也就是说,我怎样才能同时运行dotnet run 和dotnet test?
【问题讨论】: