NETSDK1045: The current .NET SDK does not support targeting .NET 9.0
The requested target framework is newer than the SDK that runs the build. Check the resolved SDK, the global.json pin, and the container image tag.

Introduction & Quick Summary
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.The project asks for a target framework newer than the SDK that is running the build. The message names both sides, and the fix is on the SDK side unless the target framework was bumped by mistake.
Why the SDK ends up older than the target:
global.jsonpins an older SDK. A repository-wide pin keeps CI on8.0.100while the project moved tonet9.0.- Only the older SDK is installed. Changing
TargetFrameworkdoes not install anything; the build finds what is on the machine. - The build host is a Docker image or a CI runner with a fixed SDK line.
mcr.microsoft.com/dotnet/sdk:8.0cannot buildnet9.0. - A second SDK is installed but not selected. Several SDKs coexist, and the resolver picks by
global.json, then by the highest installed version.
| Message | Meaning | Fix |
|---|---|---|
does not support targeting .NET 9.0 | SDK older than the requested TFM | Install a 9.x SDK |
Either target .NET 8.0 or lower | The same failure, with the fallback named | Align the TFM or the SDK |
NETSDK1147 | Workload missing | dotnet workload install |
NU1202 | Package does not support the TFM | Align the package version |
Could not load file or assembly at runtime | Built for the installed runtime, not the targeted one | Publish with the right runtime |
Core Mechanics, Signatures & Reproducible Setup
The SDK resolves in three steps: a global.json in the current directory or any parent selects a version (or a range, with rollForward), an installed SDK matching the selection is used, and otherwise the highest installed SDK is used. The target framework in the project file must be supported by that SDK. An SDK supports its own major version and all older ones, so SDK 9 builds net8.0 and net7.0, but SDK 8 never builds net9.0.
A reproduction is a project with one line changed:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>dotnet --version # 8.0.404
dotnet build
# error NETSDK1045: The current .NET SDK does not support targeting .NET 9.0.dotnet --list-sdks
# 8.0.404 [/usr/share/dotnet/sdk]
# 9.0.100 [/usr/share/dotnet/sdk]
dotnet --version
# 9.0.100Installing the newer SDK is enough when no global.json is present, because the resolver then takes the highest version installed.
Key Comparison Table
An SDK supports its own TFM and older ones. The matrix is short and explains most of these reports.
| SDK installed | net8.0 | net9.0 | net10.0 |
|---|---|---|---|
| 8.0.404 | Yes | NETSDK1045 | NETSDK1045 |
| 9.0.100 | Yes | Yes | NETSDK1045 |
| 10.0.100 | Yes | Yes | Yes |
| 8 and 9 side by side | Yes | Yes, highest wins | NETSDK1045 |
global.json decides which of several installed SDKs runs, and rollForward decides how strict the pin is.
rollForward | Meaning | Effect of a pinned 8.0.100 with 9.0.100 installed |
|---|---|---|
disable | Exact version only | Build fails if 8.0.100 is missing |
patch | Same feature band, latest patch | Stays on 8.0.1xx |
feature | Next feature band, same minor | May move to 8.0.4xx |
minor | Next minor version | Moves to 8.0.x, not 9.x |
latestPatch | Latest patch of the pinned minor | Stays in 8.0 |
latestMinor | Latest minor of the pinned major | Latest 8.0.x |
latestMajor | Latest installed major | Moves to 9.0.100 |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
Read the resolved SDK, not the installed list
dotnet --list-sdks shows what exists; dotnet --version shows what runs. In a repository the difference is usually a global.json above the project directory.
dotnet --version
dotnet --list-sdks
dotnet --info | head -20# find the global.json that is actually in effect
while [ "$PWD" != "/" ]; do [ -f global.json ] && echo "$PWD/global.json"; cd ..; doneThe walk upward is what dotnet does, so a pin in a parent directory applies even when the project has none.
Update a pin deliberately
Changing a pin changes the build for everyone, so choose the narrowest roll-forward that satisfies the project and commit the reason.
{
"sdk": {
"version": "9.0.100",
"rollForward": "latestFeature",
"allowPrerelease": false
}
}{
"sdk": {
"version": "9.0.100",
"rollForward": "latestMinor"
}
}latestFeature allows patch and feature-band updates within 9.0, which is the usual choice for a service. latestMajor is convenient for local development and risky in CI, because it silently changes the compiler on a new SDK release.
Align a Docker build
The SDK image tag fixes the build environment. A net9.0 project needs an SDK 9 image, and the runtime image must match the target framework.
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY *.csproj ./
RUN dotnet restore
COPY . .
RUN dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
WORKDIR /app
COPY /app .
ENTRYPOINT ["dotnet", "App.dll"]docker build -t app . && docker run --rm app dotnet --info | head -5A global.json inside the image that pins 8.0 produces NETSDK1045 even with the 9.0 SDK image, because the pin wins.
CI runners with a fixed SDK line
Hosted runners ship one or two SDK lines and change them on their own schedule. Pin the SDK in the workflow, not in a comment, and verify the version after setup.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
- run: dotnet --version && dotnet build --configuration Release# install locally without touching the global install
curl -sSL https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 9.0 --install-dir "$HOME/.dotnet"
export PATH="$HOME/.dotnet:$PATH"
dotnet --versionInstalling into a private directory avoids permission problems on shared machines and makes the version visible in the job log.
Visual Studio and the SDK it uses
Visual Studio has its own SDK resolution and reports the same error with a different dialog. Installing the SDK separately is not always enough; the VS installer component must be present for the IDE's build.
dotnet --list-sdks
where dotnet # Windows
which dotnet # macOS, Linux# a mismatched SDK in a solution directory is the usual cause
C:\repo\global.json -> 8.0.100
C:\repo\src\App\App.csproj -> net9.0Deleting or updating the solution-root global.json fixes the IDE without reinstalling anything.
Target framework versus runtime
A successful build does not guarantee the runtime can start the app. dotnet publish with --self-contained or a runtime identifier embeds the runtime, while a framework-dependent publish needs the matching runtime installed.
dotnet publish -c Release -r linux-x64 --self-contained false -o out
dotnet --list-runtimes
cat out/App.runtimeconfig.jsonruntimeconfig.json names the required framework version. A server with only 8.0 installed and an app requiring 9.0 fails at startup with a framework-not-found message, which is the runtime counterpart of NETSDK1045.
Common Compilation/Runtime Mistakes & Version Gotchas
Lowering TargetFramework to silence the error. It builds, but packages and APIs written for 9.0 then fail with NU1202 or missing types. Install the SDK instead.
Editing the wrong global.json. The one nearest the working directory wins, and a solution-root file overrides a project-level one. Search upward before changing anything.
Assuming dotnet --list-sdks matters. A 9.0 SDK can be installed and unused because the pin selects 8.0. dotnet --version is the resolved answer.
Using rollForward: "latestMajor" in a shared repository. The build changes when a new major SDK appears on the runner, which is exactly the surprise a pin exists to prevent.
Forgetting the runtime image. The build succeeds and the container exits with a framework-missing error, because the runtime tag was left at the previous major.
Version notes. rollForward replaced the older rollForwardOnNoCandidateFx setting in .NET Core 3.0. .NET 9 and .NET 10 both allow net8.0 projects to build with their SDK, and multi-targeting (<TargetFrameworks>net8.0;net9.0</TargetFrameworks>) requires an SDK for the newest listed framework. The NETSDK1045 text is stable across versions, so search results for older .NET Core releases describe the same cause.
Order: dotnet --version, find the effective global.json, install or select the matching SDK, then align the container and CI images. When the pin file is the suspect, the JSON formatter makes the sdk block readable next to the project file, and the env reader confirms which DOTNET_ROOT the build shell is actually using.
Official references: global.json overview and NETSDK1045.
Official references
primary documentationThe C# documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit C# work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related C# guides
All C# guidesC# await vs Task.Result: Avoid Blocking Async Code
c# await vs task result: Understand the difference between await and Task.Result in C#, why blocking on async tasks can cause deadlocks, and when it's acceptable.
System.Text.Json: The JSON value could not be converted to a type
The serializer refuses to coerce. Read the exception path, then add a converter for dates, number handling for quoted values, or an enum converter.
NuGet NU1101: unable to find the package in any source
The package is not on any feed this solution queries. Check the inherited source list first, then authentication.
.NET DI: Unable to resolve service for type while attempting to activate
Read the two type names in order, then check registration, namespace and lifetime. Includes the scoped-into-singleton follow-on error.
More in C#
All C# guidesThe guides filed next to this one in C#, in library order.