Skip to content
Latchkey

"The current .NET SDK does not support targeting .NET X" in CI

The project targets a newer .NET version than the installed SDK can build. An 8.0 SDK cannot build a net9.0 project, for example. The fix is to install an SDK at least as new as the highest TFM you target - or lower the target.

What this error means

Build fails (often as NETSDK1045) saying the current SDK does not support targeting the requested .NET version, suggesting a newer SDK or lower target. Tied to the installed SDK vs the project TFM.

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 installed SDK is older than the target TFM

The runner's SDK predates the framework version the project targets, so it cannot build it.

A TFM was bumped without updating CI

A project moved to a newer TargetFramework but the CI SDK install was not updated to match.

How to fix it

Install a newer SDK in CI

  1. Install an SDK at least as new as your highest target framework.
  2. Pin it via global.json for reproducibility.
  3. Rebuild.
workflow setup
- uses: actions/setup-dotnet@v4
  with:
    dotnet-version: '9.0.x'

Lower the target framework

  1. If you cannot upgrade the SDK, set TargetFramework to a version the SDK supports.
  2. Rebuild.
.csproj
<TargetFramework>net8.0</TargetFramework>

How to prevent it

  • Keep the CI SDK at least as new as your highest TFM.
  • Update the SDK install step whenever you bump a target framework.
  • Pin the SDK with global.json so local and CI agree.

Frequently asked questions

What causes ""... does not support targeting .NET X""?
The runner's SDK predates the framework version the project targets, so it cannot build it.
How do I fix "... does not support targeting .NET X"?
Install a newer 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