.NET 6.0 not showing in Visual Studio 2022 (General Release)

Viewed 23819

I have installed .NET 6.0 SDK and Visual Studio 2022. However, Visual Studio 2022 does not offer the ability to select .NET 6.0.

I know I can edit the project file with the target framework so please don't suggest that. This question is specifically around the Visual Studio 2022 UI.

dotnet sdks

Visual Studio 2022 UI

Edit 1:

.NET 6.0 Runtime has been selected in the Visual Studio Installer for Visual Studio 2022

Visual Studio Installer

Edit 2:

I can create .NET 6.0 projects but cannot seem to target .NET 6.0 in existing projects which were previously .NET 5.0.

New Project

5 Answers

If your solution has a gobal.json file, you can either delete it or update the sdk version over there to the latest. At the point of this answer the latest .NET version is 6.0.0 with the sdk version as 6.0.100 (Latest sdk version could be found at the dotnet core site where you downloaded your sdk)

{
    "sdk": {
        "version": "6.0.100"
    }
}

Where to confirm your sdk version from your download

After you have done that, 'Unload' and 'Reload' your project and the latest .Net Core target should show up in the dropdown.

I wonder if this is the same problem I've been struggling with - you can't change an existing project that is not in the 'sdk' format to net 6. But there is an upgrade assistant that will convert it for you.
See https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-winforms-framework

You have to install the upgrade assistant with

dotnet tool install -g upgrade-assistant

After installation, you can either analyze your project

cd "C:\your solution path"
upgrade-assistant analyze yourProject.csproj

or run the upgrade by

cd "C:\your solution path"
upgrade-assistant upgrade yourProject.csproj

The assistant will guide you through the steps.

During Visual Studio setup, you need to select the ".NET 6.0 Runtime". As can be seen in the screenshot, this option not only includes the runtime itself but also "templates for developing [...] .NET 6.0 applications".

screenshot

You can modify your installation by starting "Apps & Features" from the Windows start menu or by selecting Tools/"Get Tools and Features..." from the Visual Studio menu bar.

I have faced this issue when i used upgrade-assistant. it got upgraded to netstandard20. as part of the migration it has created the back up project also. when i open the back up project it was pointing to the net60.

Apart you can open the project file and target to the net6.0. try to unload and reload the project if it is not reflecting immediately.

I install VS 2022 and cannot create any .NET 6 applications. I am trying to create a C# .NET 6 console application but VS only allows / shows .NET framework version up to 4.8.

I can edit and build a .NET 6 solution that someone else created but I cannot create one myself with my VS 2022 v17.2.6.

Related