使用 Jenkins 为 C# Core 2.0 设置 mstest.exe

Setting up mstest.exe with Jenkins for a C# Core 2.0

我正在尝试为我的 C# 项目设置 Jenkins 服务器。服务器目前 运行 在我的本地主机上,因为我正在测试它。

到目前为止,我已经成功恢复了 NuGet 包,并使用构建配置中的 2 个步骤构建了项目。

现在,我试图让它执行我们的单元测试。这些测试是使用微软自己的测试框架进行的。

我最初尝试使用插件来 运行 测试,并使用 windows bat 文件进行设置,两者都导致同样的问题。

找不到 dll 程序集。

我的 bat 命令如下所示: "C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\Common7\IDE\MSTest.exe" /resultsfile:"%WORKSPACE%\Results.trx" /testcontainer:"%WORKSPACE%\msTests\bin\Release\netcoreapp2.0\msTest.dll" /nologo,结果是:找不到测试文件。

我假设这是因为 Jenkins 成功删除了构建程序集?我怎样才能禁用它?或者我做错了什么?

如果您使用的是 dotnet 核心,则应该使用 dotnet test 命令。 https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test?tabs=netcore21