- .NET Core - Migrations
- Restoring and Building & MSBuild
- .NET Core - MSBuild & project.json
- .NET Core - SDK
- Managed Extensibility Framework
- .NET Core - Testing Library
- Running Tests in Visual Studio
- .NET Core - Create a Testing Project
- .NET Core - PCL Troubleshooting
- Creating a Xamarin.Forms Project
- Sharing .NET Core Libraries
- Adding References to Library
- .NET Core - Portable Class Library
- Create .NET Standard Library
- Windows Runtime & Extension SDKs
- .NET Core - Metapackage
- .NET Core - MSBuild
- Create UWP App with .NET Core
- .NET Core - Package References
- .NET Core - Project Files
- .NET Core - Modularity
- .NET Core - Code Execution
- .NET Core - Garbage Collection
- .NET Core - Numerics
- .NET Core - Getting Started
- .NET Core - Environment Setup
- .NET Core - Prerequisites
- .NET Core - Overview
- .NET Core - Home
.NET Core Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
.NET Core - Migrations
In this chapter, we will migrate the console apppcation 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 toopng and now we have installed .NET Core 2.0 preview 1 toopng. Now when you build this apppcation using .NET Core 2.0 command pne utipty, 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 ..inDebug etcoreapp1.0 folder.
The following screenshot shows the directory structure and files.
Advertisements