Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2019 Not Showing .NET 5 Framework

I've been trying to upgrade my ASP.NET project in Visual Studio from the .NET 4.7.2 framework to .NET 5. I can't figure out what the problem is, because I've tried several different things and none of them have made .NET 5 available.

  1. I've installed the latest version of Visual Studio Community 2019, version 16.8.4.
  2. I've installed .NET 5.0.102. The Command Prompt confirms this when I type dotnet --version.
  3. In Visual Studio's Tools > Options > Environment > Preview Features, I've enabled "Use previews of the .NET Core SDK", and restarted the program.
  4. 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.
  5. I've tried restarting the program and my computer, and reinstalling both Visual Studio and the .NET 5.0.102 framework.

The About window in Visual Studio says that my .NET version is 4.8.040. The most recent .NET framework that I can select in my project is 4.7.2. Creating a new project doesn't offer a newer version either.

I want to work with C# 9.0, but my project is stuck in 7.3. Any idea what I'm doing wrong?

like image 363
Ransom Avatar asked Jan 14 '21 18:01

Ransom


People also ask

Does vs2019 support .NET 5?

Visual Studio 2019 supports the following . NET implementations: . NET version 5 (Visual Studio 16.8 or later)

How do I get .NET 5 in Visual Studio?

Go to Tools > Options... , and under Preview Features , tick the Use previous of . NET Core SDK (required restart) checkbox as shown in the following: Now just restart/close Visual Studio 2019 and you should now be able to see ASP.NET Core 5.0 in the list when creating a new project from the default templates.

Is .NET 5 included in Visual Studio?

NET 5.0 component in Visual Studio will be changed to out of support and optional," Microsoft said in a March 24 post. "This means that workloads in Visual Studio may be installed without installing . NET 5.0.


2 Answers

.NET 5 is not a direct replacement for .NET Framework 4.5+. If you try to create a new project and choose .NET Framework, then you will be able to choose for example 4.7, 4.8, but not .NET 5.

You will only find .NET 5 in projects which are .NET Core type.

In summary - you can't switch .NET Framework project to .NET 5 using simple Project Property window. You have to rewrite the application to .NET 5 - which is indeed the next version after .NET Core 3.1.

Regarding your question:

I want to work with C# 9.0, but my project is stuck in 7.3. Any idea what I'm doing wrong?

Please look at the C# language versions page. C# 8.0 is available for netstandard2.1 which is not supported by .NET Framework. Same thing with C# 9.0.

What is .NET 5 in comparison to .NET Core and .NET Framework you can read on Microsoft Dev Blog.

like image 84
Lukasz Szczygielek Avatar answered Oct 10 '22 15:10

Lukasz Szczygielek


.NET 5 is really the next version of .NET Core, not .NET Framework. .NET Framework is a legacy product that will only see minor maintenance fixes, like security patches, in the future.

Moving from Framework to Core involves dealing with all kinds of breaking changes and is more complicated than simply changing your project's target framework.

For that purpose, Microsoft has a migration guide for ASP.NET, which you can read to learn what you need to change in your project.

like image 42
Etienne de Martel Avatar answered Oct 10 '22 13:10

Etienne de Martel