dotnet "global.json" SDK Version Not Found in CI
A global.json pins an exact SDK version, and that version is not installed on the runner. The .NET host refuses to fall back unless rollForward allows it.
What this error means
Any dotnet command in the repo fails immediately, before building, complaining the SDK version from global.json was not found and listing the SDKs that are installed.
A compatible .NET SDK was not found.
Requested SDK version: 8.0.401
global.json file: /home/runner/work/app/global.json
Installed SDKs:
8.0.205 [/usr/share/dotnet/sdk]Common causes
The pinned SDK is not on the runner
The runner image ships a different SDK patch than global.json requires. With a strict rollForward, the host will not use a near-match.
rollForward is too strict
A rollForward of disable or patch prevents using a higher installed feature band, so a missing exact version is fatal.
How to fix it
Install the exact SDK in CI
Use actions/setup-dotnet to install the version global.json pins.
- uses: actions/setup-dotnet@v4
with:
global-json-file: global.json # installs exactly what's pinnedRelax the rollForward policy
Allow rolling forward to a newer patch or feature band so a close install satisfies the pin.
{
"sdk": {
"version": "8.0.401",
"rollForward": "latestFeature"
}
}Confirm what is installed
- Run
dotnet --list-sdksin CI to see available versions. - Compare against the
versioninglobal.json. - Either install the missing SDK or adjust the pin/rollForward to match.
How to prevent it
- Install the SDK from
global.jsonwithsetup-dotnetso CI always matches the pin. - Use a
rollForwardpolicy that tolerates patch differences across runner images. - Keep
global.jsonversions current with the runners you target.