I am trying to execute dotnet test
from the command line on our Jenkins build server, but it just hangs on:
Starting test execution, please wait...
It works fine when running this command locally
If I switch to using dotnet xunit
it fails with the following:
15:42:57 Locating binaries for framework netcoreapp2.1...
15:42:58 Running .NET Core 2.1 tests for framework netcoreapp2.1...
15:42:58 The specified framework version '2.1' could not be parsed
15:42:58 The specified framework 'Microsoft.NETCore.App', version '2.1' was not found.
15:42:58 - Check application dependencies and target a framework version installed at:
15:42:58 C:\Program Files\dotnet\
15:42:58 - Installing .NET Core prerequisites might help resolve this problem:
15:42:58 http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
15:42:58 - The .NET Core framework and SDK can be installed from:
15:42:58 https://aka.ms/dotnet-download
15:42:58 - The following versions are installed:
15:42:58 2.0.6 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
15:42:58 2.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
15:42:58 2.1.2 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
15:42:58 2.1.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
15:42:58 2.1.4 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
As per the error message, we have installed the dotnet core SDK on the server but we seem to be missing something.
My test project looks like:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="Moq" Version="4.10.0" />
<PackageReference Include="RichardSzalay.MockHttp" Version="5.0.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.console" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
</Project>