Skip to content
Latchkey

.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.

dotnet
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

  1. Use the setup step to install the SDK version the TFM requires.
  2. Confirm dotnet --version on the runner is at or above what the TFM needs.
  3. Align global.json rollForward if it is pinning an older SDK, then rebuild.
workflow
- 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.json with rollForward to make the SDK floor explicit.

Frequently asked questions

What causes ""NETSDK1045: ... does not support targeting""?
CI provisions a .NET SDK that predates the TargetFramework the project declares, so the SDK refuses to build it.
How do I fix "NETSDK1045: ... does not support targeting"?
Install the matching SDK in CI

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card