dotnet/installer

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. Download the .NET SDK from https://aka.ms/dotnet/download

OurIslam opened this issue · 3 comments

i am getting this error
Severity Code Description Project File Line Suppression State
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. Download the .NET SDK from https://aka.ms/dotnet/download ConsoleApp1 ............................\dotnet\sdk\9.0.100-alpha.1.23474.1\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 166

i have place the binary correctly
9.0.100-alpha.1.23477.3

here is my csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
  </PropertyGroup>

</Project>

and here is nuget.config
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
visual studio version
17.8.9 preview 2.0

is there anything else to use dotnet 9?

#17433 will have this support

Had the same problem. Google led me here. VS 2022 17.8.0
SDK: 9.0.100-alpha.1.23564.26

adding a global.json with this seems to do the trick:

{
  "sdk": {
    "version": "9.0.100-alpha.1.23564.26"
  }
}

@osexpert there's a Visual Studio setting in tools->options->preview features that enables preview SDKs. By default, a preview SDK won't load into a stable version of Visual Studio. I think your global.json probably forced VS to do so when the setting would have as well.