Hello, folks today I am going to migrate one of my projects called Know Your Mentor which was built in ASP.NET Core Project.json. As now Microsoft has moved towards old csproj extension which is Visual Studio .NET C# Project file extension.
You can read more about csproj structure in below-mentioned URL:
This article will be purely on migrating the application and not about project insights. so Let’s get started step by step.
Step 1: Open Visual Studio 2017
Step 2: Keep a back of your Source code. If anything goes wrong you will still have the original source code.
I am following Migrating .NET Core projects to the .csproj format article to step by step migrate my application. Let’s to migrate the same.
I hope before moving ahead ensure that you have followed above step because now the actual story starts.
Open Your Project
You will get a dialog box prompting the project is either not supported and Visual Studio will automatically make changes, Accept the message and Click Okay.
So Visual Studio has migrated Project.json to CsProj easily. Let’s now actually compile the application which is the most important part because until and unless it doesn’t successfully compile it’s of no use.
Before compiling let me check where all my dependencies which were present in Project.json was gone? Answer is in csProj
Let’s check CsProj file now and the dependencies which were present in Project.json before.
Now let’s compile the project first.
We can clearly see the project has been successfully compiled. Let’s try and run the application.
Let’s run our application now
And here comes error
In order to resolve this issue, I googled an tried deleting obj and bin files. But after doing the same the website didn’t start. So I just restarted the application and ran Visual Studio with admin rights and then ran the application. It simply worked.
We have successfully migrated our project.json to csproj. I have heard lots of people facing lot’s of the issue while migrating depending upon the application and dependencies it might have made migration a humongous task.
I hope this article would be helpful to migrate your application to csproj known as MSBuild as well. If you want to start learning ASP.NET CORE you can start from here.