Time to Upgrade to ASP.NET 5

In this tutorial, we will advise steps by steps to upgrade your ASP.NET Core 3.1 application to newest ASP.NET 5, it is easy and simple.

Steps to Upgrade to Latest ASP.NET 5

The following are steps to upgrade your ASP.NET Core 3.1 to ASP.NET 5

#1. Download .NET 5

First steps is to download .NET 5 from Microsoft site.

#2. Update Visual Studio 2019

Make sure you update your Visual Studio 2019 to 16.8 version or later in order to use .NET 5.

Once your installation has been completed, you will see below screenshot

#3. Update Project Framework

Update your ASP.NET Core 3.1 project, right click on solution -> select Properties, see below screenshot

Now, click on the Target framework and then select the .NET 5 from the dropdown and build the project.

Note: – You can update the project framework by simply updating the project file as you do see below file’s line # 3.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
     <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
     <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
  </ItemGroup>

</Project>

#4. Upgrade Nuget Packages

So, right click on the Tools and then click on the NuGet Package Manager and then click on the Manage NuGet Packages for Solution…

Now, go to Updates tab and then you will see all the packages that are available for updates. Update them and then rebuild the project

Now, you are ready to use .NET 5 project

Summary

.NET 5.0 is a major release and there are some code breaking changes introduced. So, if you are getting any errors after upgrading the target framework and nuget package, then see this post from Microsoft in which they have listed down all the breaking changes.

Thank you for reading. Keep visiting this blog and share this in your network. Please put your thoughts and feedback in the comments section.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *