Dotnet Migrate

Time to Migrate from project.json to csproj!

Most of the time I just want the facts. So, here are the facts.

Now that Visual Studio 2017 has been released and my Visual Studio Code updates have brought it to Version 1.10.2, when I opened a recent project, a project created in Visual Studio Code that includes a project.json file, I received the following error when attempting to run dotnet run:

“Couldn’t find a project to run. Ensure a project exists in … Or pass the path to the project using –project”

Now what?

It’s simple, really. I must migrate from project.json to csproj/MSBuild. To read more about the history, go here: gaprogman.

The steps to convert or migrate are:

1. Using the Integrated Terminal, which you get to via the View menu or the Ctrl + ~ keys, confirm that you have the latest version of the .NET Core SDK by running dotnet –version.

At the time of this writing, my version is 1.0.0-rc4-004771. If you don’t have this version or later, check for and install the latest (Help > Check for Updates…).

2. The source of my information, James Tayor, wrote that I need to check to see if the “migrate” command is installed. I don’t know why it wouldn’t be, but run this to check:

dotnet –help | findstr /I “migrate” and you should see this result:

migrate Migrates a project.json based project to a msbuild based project

3. Run dotnet migrate to convert or migrate to MSBuild.

4. Run dotnet restore to generate the assets file, project.assets.json.

5. Now run dotnet restore then dotnet build.

Leave a Reply

Your email address will not be published. Required fields are marked *