Skip to content
Latchkey

A compatible .NET SDK was not found (global.json) in CI

A global.json pins a specific SDK version (and roll-forward policy). When the runner does not have a matching SDK installed, dotnet refuses to fall back and errors out. The fix is to install the pinned SDK in CI or relax the pin.

What this error means

Any dotnet command fails up front with "A compatible installed .NET SDK was not found" and lists the requested vs installed versions. Deterministic for the runner's installed SDKs and the pinned version.

dotnet
A compatible installed .NET SDK for global.json version [8.0.401, rollForward latestPatch]
from [/repo/global.json] was not found.
Install the [8.0.401] .NET SDK or update [/repo/global.json] to match an installed SDK.

Common causes

global.json pins an SDK the runner lacks

The pinned version (with its roll-forward policy) does not match any SDK installed on the runner.

The CI setup did not install the pinned SDK

The workflow installed a different SDK version (or relied on a preinstalled one) than global.json requires.

How to fix it

Install the pinned SDK in CI

  1. Use actions/setup-dotnet with the version global.json requires (or point it at the file).
  2. Confirm the runner now has a matching SDK.
  3. Re-run the build.
workflow setup
- uses: actions/setup-dotnet@v4
  with:
    global-json-file: global.json

Relax the global.json pin

  1. Set a rollForward policy (e.g. latestMinor) so a nearby installed SDK is accepted.
  2. Or update the pinned version to one the runner provides.
  3. Re-run.
global.json
{
  "sdk": {
    "version": "8.0.400",
    "rollForward": "latestFeature"
  }
}

How to prevent it

  • Install the SDK from global.json in CI via global-json-file.
  • Choose a rollForward policy that tolerates patch/feature updates.
  • Keep the pinned version aligned with what your runners provide.

Frequently asked questions

What causes ""A compatible .NET SDK was not found""?
The pinned version (with its roll-forward policy) does not match any SDK installed on the runner.
How do I fix "A compatible .NET SDK was not found"?
Install the pinned SDK in CI

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card