Thursday, 27 August 2020

Migrate Asp.Net MVC 5 to .NET Core 3.1

.Net Core


I am working on a project with Asp.Net MVC 5 and we need to migrate this project to Asp.NET Core 3.1.

 I’ve found a few resources, blog posts, videos, and libraries that can help us with an upgrade to Asp.Net Core. In this post, I’m going to share them with you. So We used the below tool to check portability

.Net Portability Analyzer

.Net Portability Analyzer Tool helps us to analyze our solution to see how portable it is.


So the first step is to install the analyzer for visual studio. This extension can be found in visual studio marketplace


Go to Visual Studioà Tools à Options

Right-click on solution explorer and click on Analyze Project portability



It will build an HTML report like below to check compatibility Core Migration Step By Step


Step 1:-  Create a new empty ASP.NET Core web app with the same name as the previous project. So namespace will be match.


Step 2 :- Install the Microsoft.AspNetCore.Mvc and Microsoft.AspNetCore.StaticFiles NuGet packages. The ASP.NET runtime is modular, and you must explicitly opt in to serve static files


Step 3 :- Open the .csproj file and add a PrepareForPublish target: For example

  <Exec Command="bower install" />