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.
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
- Use
actions/setup-dotnetwith the versionglobal.jsonrequires (or point it at the file). - Confirm the runner now has a matching SDK.
- Re-run the build.
- uses: actions/setup-dotnet@v4
with:
global-json-file: global.jsonRelax the global.json pin
- Set a
rollForwardpolicy (e.g.latestMinor) so a nearby installed SDK is accepted. - Or update the pinned version to one the runner provides.
- Re-run.
{
"sdk": {
"version": "8.0.400",
"rollForward": "latestFeature"
}
}How to prevent it
- Install the SDK from
global.jsonin CI viaglobal-json-file. - Choose a
rollForwardpolicy that tolerates patch/feature updates. - Keep the pinned version aligned with what your runners provide.