GitHub Actions actions/setup-dotnet "Could not find dotnet SDK"
actions/setup-dotnet cannot resolve the requested .NET SDK. The dotnet-version is wrong, a global.json pins an SDK that is not available, or the channel/quality combination yields nothing.
What this error means
The setup-dotnet step fails saying it could not find the requested SDK version, often referencing global.json. The dotnet CLI is not installed, so build/test steps fail afterward.
Error: Could not find dotnet SDK version '8.0.999'
# or, from global.json:
A compatible .NET SDK was not found matching version '8.0.100' from global.jsonCommon causes
Version not in the release index
A non-existent patch (8.0.999) or a too-specific pin that has not shipped cannot be resolved against the .NET release index.
global.json pins an unavailable SDK
If global.json sets sdk.version to an exact build, setup-dotnet must install that exact SDK. A stale or unreleased pin fails the resolution.
How to fix it
Request a channel or band, not a phantom patch
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x' # latest patch in the 8.0 bandAlign global.json with rollForward
Allow roll-forward so a slightly newer SDK satisfies the pin instead of requiring an exact, possibly-missing build.
{
"sdk": {
"version": "8.0.100",
"rollForward": "latestFeature"
}
}How to prevent it
- Use feature-band specs like 8.0.x rather than exact phantom patches.
- Set rollForward in global.json so CI tolerates newer patch SDKs.
- Keep setup-dotnet current so newly released SDKs resolve.