Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run "dotnet xunit PathToLibrary.dll" from command line (in Continous Integration)

I am able to "dotnet xunit" when I am in folder where the project is.

How can I do it from command line where I want to pass already compiled dll as a parameter.

dotnet xunit PathToLibrary.dll

I get an error:

No executable found matching command "dotnet-xunit"

I have copied "xunit.execution.desktop.dll" (get from nuget xunit.core.2.3.0) into current folder, but that does not help.

like image 980
Krzysztof Morcinek Avatar asked Oct 26 '17 12:10

Krzysztof Morcinek


Video Answer


2 Answers

dotnet-xunit is a per-project CLI tool

Consuming these tools requires you to add a <DotNetCliToolReference> element to your project file for each tool you want to use. Inside the <DotNetCliToolReference> element, you reference the package in which the tool resides and specify the version you need. After running dotnet restore, the tool and its dependencies are restored.

So check that your .csproj contains

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

then do

dotnet restore
like image 55
Set Avatar answered Sep 19 '22 21:09

Set


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
like image 39
M.Hassan Avatar answered Sep 23 '22 21:09

M.Hassan