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.
Looking forward to availing of community help!
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.
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). .
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>
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.
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.
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.
.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.
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.
To get Visual Studio 2019 to work with .NET 6 all you have to do is the following:
<TargetFramework>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
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.
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)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With