gilab-ci.yaml – Unable to run Nunit tests with dotnet
Here is my gitlab-ci.yaml:
image: microsoft/dotnet:latest stages: - test - deploy before_script: - dotnet restore ./WorldServer.sln release: stage: deploy only: - master artifacts: paths: - build/release/WorldServer.exe script: # The output path is relative to the position of the csproj-file - dotnet build .\WorldServer.sln debug: stage: test script: # The output path is relative to the position of the csproj-file - dotnet test ./WorldServer.sln
Here is the output when the runner executes:
Running with gitlab-runner 13.1.1 (6fbc7474) on codescarsgaming gM7RAymZ Preparing the "docker" executor Using Docker executor with image microsoft/dotnet:latest ... Pulling docker image microsoft/dotnet:latest ... Using docker image sha256:156e5cc5d7a3aaf4166d17f1e0b3a3c262a22caf8efac9b855ba1782ef98071c for microsoft/dotnet:latest ... Preparing environment 00:03 Running on runner-gm7raymz-project-2-concurrent-0 via codescarsgaming... Getting source from Git repository 00:05 Fetching changes with git depth set to 50... Reinitialized existing Git repository in /builds/ScarsOfHonor/Server/.git/ Checking out 74c78e7e as master... Removing WorldServer.Tests/obj/WorldServer.Tests.csproj.nuget.cache Skipping Git submodules setup Executing "step_script" stage of the job script 00:14 $ dotnet restore ./WorldServer.sln Restore completed in 4.3 sec for /builds/ScarsOfHonor/Server/WorldServer.Tests/WorldServer.Tests.csproj. $ dotnet test ./WorldServer.sln /usr/share/dotnet/sdk/2.1.807/Microsoft.Common.CurrentVersion.targets(1175,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.6.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/builds/ScarsOfHonor/Server/WorldServer.Tests/WorldServer.Tests.csproj] ERROR: Job failed: exit code 1
Why am I receiving this error and how can I fix it?