Dave Kapildev
Dave Kapildev

Reputation: 511

Migrate .NET Framework 4.8 to .NET 5

Recently Microsoft has release .NET 5. If we want to upgrade .NET Framework 4.8 to .net 5 then how can we accomplish this task.

Please Note :

  1. I had already upgrade Visual Studio 18.2 with all latest component and .net Framework 5. But in project property .net 5 is not displayed.

  2. My application is in .net Framework not in .net core.

Update Feb 02, 2021 Same Question I had posted on Microsoft Forum and luckily they replied very positively.

https://developercommunity2.visualstudio.com/t/net-framework-48-upgrade-to-net-5/1269991?from=email&viewtype=all#T-ND1352565

Update August 2021

Message from Microsoft

We’ll continue to make the .NET Upgrade Assistant better through previews that will coming out in the GitHub repo. You can find it here: https://github.com/dotnet/upgrade-assistant

Update May 2023 one more link I found. It may helpful

https://procodeguide.com/dotnet/migrate-net-framework-to-net-core/

Update Nov 2023

Require Visual Studio 17.6 or Later

https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.upgradeassistant

Download Microsoft .NET Upgrade Assistant which support to

.NET Upgrade Assistant (Preview) The goal of this extension is to assist in upgrading your .NET applications to the latest versions of .NET. After installing the extension, you can right-click in Solution Explorer on the project you want to upgrade, choose “Upgrade” and follow the steps.

See the Upgrade Assistant blog post for more information.

enter image description here

Supported .NET upgrades:

.NET Framework to .NET 6+ (including .NET 8.0 Preview)

.NET Core to .NET 6+ (including .NET 8.0 Preview)

Any .NET version to .NET 6+ (including .NET 8.0 Preview) that is higher than the current version

Azure Functions v1, v2, v3 to v4 isolated (targeting net6.0 or net7.0) Xamarin.Forms to MAUI

Note: For Xamarin->MAUI .xaml file transformations the Upgrade Assistant includes basic namespace replacements. More comprehensive .xaml file transformations require Visual Studio 17.6.

Supported project types:

  1. ASP.NET
  2. Azure Functions
  3. WPF
  4. WinForms
  5. Class libraries
  6. Console
  7. Xamarin.Forms
  8. .NET
  9. MAUI
  10. UWP

Happy upgrading!

Upvotes: 29

Views: 39939

Answers (3)

Dumindu De Silva
Dumindu De Silva

Reputation: 173

you can use .NET Upgrade Assistant tool released by Microsoft. This tool will easily convert your .net framework project to .net5.

Upvotes: 8

Giorgio
Giorgio

Reputation: 144

.NET 5 is the evolution of .NET core. So it is not a trivial change. Firstly, you need to have Visual Studio 2019 (v16.8) (make sure that include .NET in the installation). Second, you need to review if all your NuGet packages and libraries support this (and update it or look for a replacement). Additionally you can take a look if any of the breaking changes affect you https://learn.microsoft.com/en-us/dotnet/core/compatibility/5.0. Keep in mind that .NET 5 is not an LTS, meaning that it will not be supported when .NET 6 comes out.

Depending on your architecture (layers of separations), how big is your solution and if you are using .NET standard for libraries, will depend on the effort you need to do (you might also need to do some refactoring). Anyhow you should plan this thoroughly since is not a trivial migration.

Upvotes: 6

Peter Macej
Peter Macej

Reputation: 5577

You didn't mention what's the type of your project. But in general, you should follow the official docs. For example, for winforms projects, see How to migrate a Windows Forms desktop app to .NET 5.

Most likely, as the first thing, you will need to edit your project file manually and change it to the SDK style, as described in the article above:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
   ...
  </PropertyGroup>

</Project>

Upvotes: 10

Related Questions