.NET SDK "NETSDK1045: current SDK does not support targeting" in CI
NETSDK1045 means the SDK installed on the runner is too old for the target framework the project asks for. A net9.0 project cannot be built by a .NET 8 SDK. The fix is to install the matching SDK on the runner, not to change the project.
What this error means
The build fails with NETSDK1045 naming the requested framework and offering to target an older one. It reproduces every run until the SDK is updated.
error NETSDK1045: The current .NET SDK does not support targeting .NET 9.0.
Either target .NET 8.0 or lower, or use a version of the .NET SDK that supports .NET 9.0.Common causes
The runner SDK is older than the project TFM
CI provisions a .NET SDK that predates the TargetFramework the project declares, so the SDK refuses to build it.
global.json pins an SDK that is too old
A global.json rollForward policy resolves to an SDK below the one the TFM needs.
How to fix it
Install the matching SDK in CI
- Use the setup step to install the SDK version the TFM requires.
- Confirm
dotnet --versionon the runner is at or above what the TFM needs. - Align
global.jsonrollForward if it is pinning an older SDK, then rebuild.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'How to prevent it
- Keep the CI SDK version in lockstep with the highest project TFM.
- Use
global.jsonwith rollForward to make the SDK floor explicit.