Ransom
Ransom

Reputation: 103

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?

Upvotes: 10

Views: 12473

Answers (2)

Lukasz Szczygielek
Lukasz Szczygielek

Reputation: 3129

.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.

Upvotes: 12

Etienne de Martel
Etienne de Martel

Reputation: 36996

.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.

Upvotes: 1

Related Questions