Managing multiple SDKs with "dotnet --info"

Posted: (EET/GMT+2)

 

If you work with several .NET Core versions on the same machine, it's good to know which SDKs and runtimes are installed and active. The easiest way is to run:

dotnet --info

This shows the current (usually, most recent) .NET CLI version, base path, and a list of installed SDKs and runtimes. Example output:

.NET Command Line Tools (2.1.101)
Product Information:
 Version:            2.1.101
 Commit SHA-1 hash:  abcd1234

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.101\

Host (useful for support):
  Version: 2.0.7
  Architecture: x64
  RID: win10-x64

.NET Core SDKs installed:
  1.1.9  [C:\Program Files\dotnet\sdk]
  2.0.3  [C:\Program Files\dotnet\sdk]
  2.1.101 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.NETCore.App 1.1.10 [...]
  Microsoft.NETCore.App 2.0.7 [...]

You can set a specific SDK per project by adding a global.json file to your solution root:

{
  "sdk": {
    "version": "2.0.3"
  }
}

That locks builds to the chosen SDK even if newer ones are installed. Handy when you’re maintaining older projects or building in CI environments.