dotnet "NETSDK1141: Unable to resolve the .NET SDK version" in CI
NETSDK1141 means the build host could not resolve the SDK version global.json asks for - the requested version (and any roll-forward) does not map to an installed SDK. The build stops before any project work.
What this error means
A build fails with NETSDK1141 saying the SDK version in global.json could not be resolved. It is deterministic on that runner because the pinned SDK simply is not resolvable from what is installed.
error NETSDK1141: Unable to resolve the .NET SDK version as specified in the
global.json located at /home/runner/work/app/global.json.Common causes
Pinned SDK not installed and not roll-forwardable
The exact version (or feature band) in global.json is absent and the rollForward policy will not bridge to an installed SDK, so resolution fails.
Malformed or unexpected global.json
A global.json with an unparseable version, or an allowPrerelease/rollForward combination that excludes every installed SDK, leaves nothing to resolve.
How to fix it
Install the SDK global.json pins
Have CI install exactly the version the file requires.
- uses: actions/setup-dotnet@v4
with:
global-json-file: global.jsonRelax the roll-forward policy
Allow rolling forward to a newer installed feature band so a close install resolves.
{
"sdk": { "version": "8.0.400", "rollForward": "latestFeature" }
}How to prevent it
- Install the SDK from
global.jsonwithsetup-dotnetso resolution always succeeds. - Use a tolerant
rollForwardso patch/feature-band drift does not break resolution. - Validate
global.jsonparses and lists a version your runners can satisfy.