Cannot build .net9.0 with Visual Studio 2022 Image
I have projects that target .net9.0. Recently, I am not able to build them anymore. I get the error:
MSBuild auto-detection: using msbuild version '17.11.2.32701' from 'C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin'.
dotnet : C:\Program Files\dotnet\sdk\8.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(166,5): 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 [C:\projects\aspdeck\src\AspDeck\AspDeck.csproj]
At C:\projects\aspdeck\build.ps1:1 char:1
+ dotnet run --project build/Build.csproj -- $args
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (C:\Program File...AspDeck.csproj]:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
This happens with projects that I have been able to build without problems, but even when I rebuild a build that previously succeeded, it now fails.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Meerow on 01 Dec, 2024 06:23 PM
I have tried to select "Previous Visual Studio 2022" in project settings, but I get the same error:
MSBuild auto-detection: using msbuild version '17.11.2.32701' from 'C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin'.
dotnet : C:\Program Files\dotnet\sdk\8.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(166,5): 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 [C:\projects\aspdeck\src\AspDeck\AspDeck.csproj]
At C:\projects\aspdeck\build.ps1:1 char:1
+ dotnet run --project build/Build.csproj -- $args
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (C:\Program File...AspDeck.csproj]:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
2 Posted by Meerow on 02 Dec, 2024 05:00 PM
The log shows that the SDK 8 is pulled for building, but why is that? My projects target .Net 9. I am in the middle of upgrading my nuget packages to .net9 and now I am kind of stuck in the middle, because this issue came up.
Support Staff 3 Posted by Owen McDonnell on 02 Dec, 2024 06:48 PM
We've not yet released images with .net 9 sdk. How are you adding it to your build environment? Can you share your build configuration?