The dotnet 1.0.1 tooling includes a tool called dotnet-migrate.
Just run:
1$ dotnet migrate
More info here at the Microsoft Docs here.
But it dint work for me. This is what I got:
1$ dotnet migrate
2No executable found matching command "dotnet-migrate"
I tried re-updating dotnet by downloading the latest setup (v1.0.1) from here, but it din’t help either.
That’s when I happened to run dotnet --info from the project directory:
1$ dotnet --info
2.NET Command Line Tools (1.0.0-preview2-1-003177)
3
4Product Information:
5 Version: 1.0.0-preview2-1-003177
6 Commit SHA-1 hash: a2df9c2576
7
8Runtime Environment:
9 OS Name: Mac OS X
10 OS Version: 10.11
11 OS Platform: Darwin
12 RID: osx.10.11-x64
Notice the version? It’s still using the old tooling.
However running it from ~ showed this as I’d expect:
1$ dotnet --info
2.NET Command Line Tools (1.0.1)
3
4Product Information:
5 Version: 1.0.1
6 Commit SHA-1 hash: 005db40cd1
7
8Runtime Environment:
9 OS Name: Mac OS X
10 OS Version: 10.11
11 OS Platform: Darwin
12 RID: osx.10.11-x64
13 Base Path: /usr/local/share/dotnet/sdk/1.0.1
That’s when I realized the culprit. The project had a global.json file with the old SDK version in it.
All I had to do was update the SDK version in it to 1.0.1:
1{
2 "projects": [ "." ],
3 "sdk": {
4 "version": "1.0.1"
5 }
6}
And everything worked as expected.
The global.json file is used to select an SDK version and is useful because:
- You can be sure that everyone in your team uses the same SDK version
- You can have multiple SDK versions installed and use different SDKs for different projects if need be.