mniyf
mniyf

Reputation: 21

Trouble Running .NET 8 Projects After Installing SDK 8

I recently installed .NET SDK 8 and verified its installation using the command dotnet --version, which shows 8.0.204. However, when I attempt to open a project targeting .NET 8, I encounter the following error:

Severity Code Description Project File Line Suppression State 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. ConsoleApp5 C:\Program Files\dotnet\sdk\7.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 144

This is puzzling because my installed SDK appears to be up-to-date. Here's the output of dotnet --list-sdks:

5.0.409 [C:\Program Files\dotnet\sdk]

7.0.203 [C:\Program Files\dotnet\sdk]

8.0.204 [C:\Program Files\dotnet\sdk] and the version: C:\Users\user1>

and when i run: dotnet --version 8.0.204

As you can see, SDK 8.0.204 is indeed installed.

Can anyone help me diagnose and solve this issue? I'm at a loss for what could be causing it. Thank you in advance for any assistance you can provide.

I've tried verifying the installation of the .NET SDK by running dotnet --version, which confirmed that SDK 8.0.204 is installed. Additionally, I've checked the list of installed SDKs using dotnet --list-sdks, which also confirms the presence of SDK 8.0.204. Despite this, I still encounter the error mentioned previously when attempting to open a project targeting .NET 8. I expected that with the correct SDK installed, the project would compile and run without any issues on .NET 8. However, the error persists, and I dont understand.

Upvotes: 2

Views: 4082

Answers (2)

Hammad Maqbool
Hammad Maqbool

Reputation: 33

If you want to use .NET8 keep using it, but in global.json file keep the version 9.0.0 this is the SDK version.

Things will work fine this way.

Upvotes: 1

mniyf
mniyf

Reputation: 21

I managed to solve the problem I went to "Add or Remove Programs" on the computer. I had both SDK 7 and SDK 8 installed there I removed by visual studio installer (modify) the version of 7 I updated the version of vs 2022 And works great Thanks to all the helpers

Upvotes: 0

Related Questions