Reputation: 103
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.
dotnet --version
.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
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
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