Sdk: dotnet does not find latest patch version of SDK specified in global.json

Created on 24 May 2019  路  1Comment  路  Source: dotnet/sdk

Steps to reproduce

  • Install latest SDK version (2.2.204 in my casse)
  • Install SDK version 2.1.300
  • in global.json set sdk.version to 2.1.0
  • try to dotnet restore the project.

Expected behavior

All dependencies get installed.

Actual behavior

I get an error message, stating "A compatible SDK version for global.json version: [2.1.0] from [...] was not found.

Environment data

dotnet --info output:

A compatible SDK version for global.json version: [2.1.0] from [...] was not found

Host (useful for support):
  Version: 2.2.5
  Commit:  0a3c9209c0

.NET Core SDKs installed:
  2.1.300 [C:\Program Files\dotnet\sdk]
  2.1.700 [C:\Program Files\dotnet\sdk]
  2.2.204 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

notes

According to https://docs.microsoft.com/en-us/dotnet/core/tools/global-json#matching-rules, when dotnet does not find the exact sdk version specified in global.json, it should use the latest patch version instead (which would be 2.1.700 in my case, or 2.1.300 when just following the mentioned steps above). But it does not do that, so I think either the docs are wrong, or there is a bug.

>All comments

Patchs for the SDK are on the hundreds version, for instance, 2.1.300 would match 2.1.300, 2.1.301, 2.1.303, etc.

We are considering a way to specify a major.minor version on the global.json but that does not exist yet. As such, right now, this issue is by design.

Was this page helpful?
0 / 5 - 0 ratings