Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2019 Not Showing .NET 6 Framework

I've been struggling to change an asp.net core web api project's target framework to .NET 6 which was started using target framework .net5. I've already tried a few options but couldn't find the .NET 6 framework listed in the target dropdown.

  1. I am using Microsoft Visual Studio Enterprise 2019 Version 16.11.3.
  2. I've installed .NET 6.0.0-rc.2.21480.5. which is verified through dotnet --version.
  3. Enabled "Use previews of the .NET Core SDK", and restarted the program.
  4. restarted workstation several times & still no luck.

Looking forward to availing of community help!

like image 482
Yasir Arafat Avatar asked Oct 29 '21 18:10

Yasir Arafat


People also ask

How do I get .NET 6 in Visual Studio 2019?

To get Visual Studio 2019 to work with . NET 6 all you have to do is the following: Install the . NET 6 SDK: https://dotnet.microsoft.com/download.

Is .NET 6 supported in VS 2019?

NET 6 is supported with Visual Studio 2022 and Visual Studio 2022 for Mac. It is not supported with Visual Studio 2019, Visual Studio for Mac 8, or MSBuild 16. If you want to use . NET 6, you will need to upgrade to Visual Studio 2022 (which is also now 64-bit). .

Does Visual Studio 2019 support net 6?

Visual Studio 2019 does not support .NET 6 (also see VS support in the release notes ). Install VS 2022 for full .NET 6 support. Show activity on this post. To get Visual Studio 2019 to work with .NET 6 all you have to do is the following: open the project file in notepad or Notepad++, basically any txt editor and find the node: <TargetFramework>

What's the latest version of Visual Studio Community 2019?

I've installed the latest version of Visual Studio Community 2019, version 16.8.4. I've installed .NET 5.0.102. The Command Prompt confirms this when I type dotnet --version. In Visual Studio's Tools > Options > Environment > Preview Features , I've enabled "Use previews of the .NET Core SDK", and restarted the program.

How many versions of Visual Studio have been released for NET Framework?

Since the first version, Microsoft has released nine more upgrades for .NET Framework, seven of which have been released along with a new version of Visual Studio. Two of these upgrades, .NET Framework 2.0 and 4.0, have upgraded Common Language Runtime (CLR). New versions of .NET Framework replace older versions when the CLR version is the same.

How can I preview a version of the net core SDK?

In Visual Studio's Tools > Options > Environment > Preview Features , I've enabled "Use previews of the .NET Core SDK", and restarted the program. In Visual Studio Installer, I've selected Modify > Individual components. The .NET 5.0 Runtime is installed, but there's nothing listed for a .NET Framework 5; the highest listed is 4.8.


Video Answer


5 Answers

.NET 6 is not supported in VS2019. You might make it work by manually editing your project file, but for a fully supported experience you should upgrade to VS2022.

like image 117
Drew Noakes Avatar answered Oct 21 '22 18:10

Drew Noakes


You don't need to use the dropdown - open your .csproj file and change target framework manually:

<TargetFramework>net6.0</TargetFramework>

As for dropdown - it seems that there is some bug in VS - I have 16.11.5 installed alongside VS 2022 preview and the "Use previews of the .NET Core SDK" flag enabled and even project using .NET 6 (which builds and runs via VS2019). Also despite missing .NET 6 in the project properties the new project wizard has it.

P.S. Submitted an issue for Visual Studio.

UPD

Visual Studio 2019 does not support .NET 6 (also see VS support in the release notes). Install VS 2022 for full .NET 6 support.

like image 28
Guru Stron Avatar answered Oct 21 '22 16:10

Guru Stron


To get Visual Studio 2019 to work with .NET 6 all you have to do is the following:

  • Install the .NET 6 SDK: https://dotnet.microsoft.com/download
  • Open your VS project that you want to switch to .NET 6
  • Build your project with .NET 5(+)
  • go into the project dir and find your project file: .csproj
  • open the project file in notepad or Notepad++, basically any txt editor and find the node: <TargetFramework>
  • If you built your project with .NET 5(+) it will read as: <TargetFramework>net5.0-windows</TargetFramework>
  • Simply switch the value to: net6.0-windows 5 changed to 6
  • Your TargetFramework entry should be edited to: <TargetFramework>net6.0-windows</TargetFramework>
  • Now save your project file
  • Next simply boot up Visual Studio 2019 and the target project you just modified to run .NET 6.
  • Do a clean on your project under the [ Build ] menu item
  • Now re-build your project and you are good to go \m/ :) \m/

Note I am using a Windows platform example the same concept should work for Linux etc just look at what the .NET 5 node looks like for the <TargetFramework> and just swap in the 6 instead of 5 and keep what ever other txt is in the value. I have not tried other platforms other than Windows but I am sure it will work as well.

I have swapped various projects and complicated ones and .NET 6 works perfectly in all cases on Visual Studio 2019! I personally will get Visual Studio 2022 as soon as I can but am very happy I can start .NET 6 development on day one on VS2019 till I can upgrade to 64bit goodness and Hot Reloading etc.

Anyways I hope this helps someone.

like image 10
valcan_s Avatar answered Oct 21 '22 17:10

valcan_s


Update Visual Studio to Vs2019 16.11.7 My Problem solved But First you have to Check the Checkbox: Tools>Options>Environment>Preview Features>Use Preview Of .Net SDK(requires restart)

like image 5
Ehsan Avatar answered Oct 21 '22 18:10

Ehsan


image

Dotnet 6.0 is only supported in visual studio 2022. you can check details from here: https://dotnet.microsoft.com/en-us/download/dotnet/6.0

like image 3
Hgrbz Avatar answered Oct 21 '22 17:10

Hgrbz