Skip to content
Latchkey

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

  1. Provision the full SDK (not just the runtime) for the version you build.
  2. Ensure any global.json resolves to that installed SDK.
  3. 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.json pointed at an installed SDK.
  • Reference Microsoft.NET.Test.Sdk in every test project.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →