In this chapter, we will migrate the console application which contains the project.json file build system instead of MSBuild (*.csproj). So, we have an old project which contains the following files.
Now the question is, why do we need migration? This project is created using .NET Core 1.0 preview 2 tooling and now we have installed .NET Core 2.0 preview 1 tooling. Now when you build this application using .NET Core 2.0 command line utility, then you will see the following error.
This is because the project.json build system is no longer available in .NET Core 2.0, so we need migration so that it can work properly. To see the available commands, let us run the following command.
In the commands section, you can see the different commands and you can also see the migrate command which will migrate a project.json based project to a MSBuild based project.
Let us now run the following command.
You will see a summary of the migration process and here you can also see that a project is migrated successfully.
Let us now see the directory structure by using the following command.
You will now see the *.csproj file along with Program.cs file in the project root directory and project.json is moved to the backup folder.
Let us open the console.csproj file. Now you can restore and build this project using the MSBuild system by running the following command.
You can now see that all the packages are restored.
You can now build your project with the following command.
You can now see that the project is built successfully using MSBuild and console.dll is also generated in ..\bin\Debug\netcoreapp1.0 folder.
The following screenshot shows the directory structure and files.