dotnet "vstest.console.dll could not be found" in CI
dotnet test (or a VSTest task) could not locate vstest.console.dll. The test platform component is missing from the SDK on the runner, or the wrong SDK path is in use.
What this error means
dotnet test fails with "Could not find /usr/share/dotnet/sdk/.../vstest.console.dll" or a pipeline VSTest task reports the runner could not be found.
dotnet
Could not find /usr/share/dotnet/sdk/8.0.303/vstest.console.dll.
Make sure the .NET SDK with the test platform is installed.Common causes
The SDK install is incomplete or wrong
A partial SDK, or a global.json pointing at an SDK folder that lacks the test platform, leaves no vstest.console.dll.
A runtime-only install, not the SDK
The runner has the .NET runtime but not the SDK, so the test platform that ships with the SDK is absent.
How to fix it
Install a complete SDK with setup-dotnet
- Provision the full SDK (not just the runtime) for the version you build.
- Ensure any
global.jsonresolves to that installed SDK. - Re-run
dotnet test.
.github/workflows/ci.yml
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'Reference the test SDK in the project
Ensure the test project pulls Microsoft.NET.Test.Sdk, which brings the VSTest components for dotnet test.
MyApp.Tests.csproj
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />How to prevent it
- Install the full .NET SDK, not just the runtime, in CI.
- Keep
global.jsonpointed at an installed SDK. - Reference
Microsoft.NET.Test.Sdkin every test project.
Related guides
dotnet test "No test is available" in CIFix dotnet test "No test is available in ... Make sure that test discoverer and executors are registered" in…
dotnet test "Testhost process crashed" during the run in CIFix dotnet test "The active test run was aborted. Reason: Test host process crashed" in CI - the process runn…
.NET "A compatible .NET SDK was not found" (global.json) in CIFix "A compatible .NET SDK was not found" / "Requested SDK version ... was not found" in CI - global.json pin…