- .NET Core Tutorial
- .NET Core - Home
- .NET Core - Overview
- .NET Core - Prerequisites
- .NET Core - Environment Setup
- .NET Core - Getting Started
- .NET Core - Numerics
- .NET Core - Garbage Collection
- .NET Core - Code Execution
- .NET Core - Modularity
- .NET Core - Project Files
- .NET Core - Package References
- Create UWP App with .NET Core
- .NET Core - MSBuild
- .NET Core - Metapackage
- Windows Runtime & Extension SDKs
- Create .NET Standard Library
- .NET Core - Portable Class Library
- Adding References to Library
- Sharing .NET Core Libraries
- Creating a Xamarin.Forms Project
- .NET Core - PCL Troubleshooting
- .NET Core - Create a Testing Project
- Running Tests in Visual Studio
- .NET Core - Testing Library
- Managed Extensibility Framework
- .NET Core - SDK
- .NET Core - MSBuild & project.json
- Restoring and Building & MSBuild
- .NET Core - Migrations
- .NET Core Useful Resources
- .NET Core - Quick Guide
- .NET Core - Useful Resources
- .NET Core - Discussion
.NET Core - Migrations
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.
dotnet help
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.
dotnet migrate
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.
tree /f
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.
dotnet restore
You can now see that all the packages are restored.
You can now build your project with the following command.
dotnet build
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.
To Continue Learning Please Login
Login with Google