error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 7.0 or lower, or use a version of the .NET SDK that supports .NET 8.0
The installed .NET SDK is older than the project’s TargetFramework.
Exact message you may see
The current .NET SDK does not support targetingNETSDK1141 Unable to resolve the .NET SDK version as specified in the global.json
Seen on:
.NET
Meaning
global.json pinning an old SDK, CI images with old SDKs, or Visual Studio versions bundling older SDKs cause this.
Common causes
- SDK not installed for the target framework
- global.json pins an older SDK
- CI image/setup-dotnet using an old version
- Old Visual Studio/MSBuild
⚡ Quick fix
- Install the matching SDK
- Update or remove global.json’s version
- Set the SDK version in CI (actions/setup-dotnet)
Detailed fix by platform
Shell
- csharp
dotnet --list-sdks cat global.json
YAML
- csharp
- uses: actions/setup-dotnet@v4 with: { dotnet-version: '8.0.x' }
How to diagnose
- SDKs — dotnet --list-sdks
- Pin — global.json
- CI — Configured version
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- COPY failed COPY failed: file not found in build context / "/app/x": not found
- DefaultAzureCredential failed DefaultAzureCredential failed to retrieve a token from the included credentials / ManagedIdentityCredential authentication unavailable
- did not complete successfully failed to solve: process "/bin/sh -c ..." did not complete successfully: exit code: 1
Most viewed in .NET
- Unable to cast object of type System.InvalidCastException: Unable to cast object of type 'X' to type 'Y'
- NullReferenceException System.NullReferenceException: Object reference not set to an instance of an object
- Cannot access a disposed context instance ObjectDisposedException: Cannot access a disposed context instance
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Did this fix work for you?
Report a correction or suggest an improvement
Last updated 13 Oct 2026