Migrating to MSBuild from project.json with the dotnet migrate command
In the previous post I introduced a way to use a wrapper script that uses the Docker image for the .NET Core SDK as a replacement for the installed version of the SDK.
In the current version (1.1.1 as I write this) the use of project.json files have been deprecated in favor of MSBuild .csproj files.
In this post I will show how I used my wrapper script to migrate one project to use MSBuild .csproj files.
In terms of the migration script the dotnet migrate command is no different than any other. However, I wanted to be careful and so I opted to use the interactive mode of my wrapper script.
To get started I made sure that the git repository was clean. There was nothing that needed to be committed and there were no untracked files. This way I was free to use the git clean and git reset command as I needed should something go awry.
Note that because of the way the wrapper script mounts the local directories needed for work with .NET Core in my project, I could be in an interactive session in the container and in my local editor at the same time. In another local terminal session should I issue a git clean and git reset I could simply continue in the container interactive session completely seamlessly.
From within the project directory I issued the following command to get started:
Once inside the dotnet SDK Docker container I did:
and watched what it was doing. A git status in my local terminal session showed me what the result of that operation was. Satisfied with it, I committed the result.
YMMV – but, I could not get the current (1.0.1) version of the migrate command to acknowledge my global.json file. With that in mind, I needed to go into each project directory and repeat the process.
Solution (.sln file) support is coming to the dotnet command line utility. But it is not there yet. You can add, remove and list projects but not create a new solution – yet.
A quick one this time. But I wanted to dispel any anxiety that might be out there about migrating to the newest version of the SDK.