如何运行" dotnet xunit PathToLibrary.dll"从命令行(在连续集成中)

时间:2017-10-26 12:12:43

标签: .net-core xunit xunit.net

我能够" dotnet xunit"当我在项目所在的文件夹中时。

如何从命令行执行此操作,我希望将已编译的dll作为参数传递。

dotnet xunit PathToLibrary.dll

我收到错误:

No executable found matching command "dotnet-xunit"

我复制了" xunit.execution.desktop.dll" (从nuget xunit.core.2.3.0获取)到当前文件夹,但这没有帮助。

2 个答案:

答案 0 :(得分:10)

dotnet-xunit是per-project CLI tool

  

使用这些工具需要您为项目文件添加<DotNetCliToolReference>元素,以用于您要使用的每个工具。在<DotNetCliToolReference>元素内,您可以引用该工具所在的包,并指定所需的版本。运行dotnet还原后,将恢复该工具及其依赖项。

请检查您的.csproj是否包含

<ItemGroup>
   <DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0" />
</ItemGroup>

然后做

dotnet restore

答案 1 :(得分:3)

This answer isn't a direct answer to OP, but necessary for users of dotnet xunit

dotnet xunit is removed starting from xunit 2.4 Ref: Release Notes 2.4

Excerpt from the Release Notes:

Unfortunately, this release also removes the dotnet xunit runner, as the stability of the runner was never perfect, and it suffered from many assembly-loading related issues. Users from .NET Core can continue to use VSTest (either inside Visual Studio, or via dotnet test).

So, for xunit framework test use the command

   dotnet test
相关问题