Skip to content

global.json is ignored unless the SDK version is an exact match for a currently installed SDK #13799

@crozone

Description

@crozone

Issue Title

global.json is ignored unless the SDK version is an exact match for a currently installed SDK.

General

global.json SDK version and rollForward behaviour appears to be ignored if the version string is not an exact match for one of the .NET SDK versions currently installed on the machine. This has unintended consequences when building code on different machines with different dotnet SDKs installed.

This occurs on dotnet host 5.0.0-rc.1.20451.14, I have not yet tested on previous dotnet hosts.

Host (useful for support):
  Version: 5.0.0-rc.1.20451.14
  Commit:  38017c3935

Example

The simplest example is if global.json specifies an SDK version 3.1.000, because 3.1.000 is not an SDK version that exists.

global.json:

{
  "sdk": {
    "version": "3.1.000",
    "rollForward": "latestFeature"
  }
}

For reference, here are the currently installed SDKs on my machine:

.NET SDKs installed:
  2.1.802 [C:\Program Files\dotnet\sdk]
  3.1.100 [C:\Program Files\dotnet\sdk]
  3.1.200 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]
  3.1.402 [C:\Program Files\dotnet\sdk]
  5.0.100-rc.1.20452.10 [C:\Program Files\dotnet\sdk]

Expected behaviour:

The dotnet host should pick the latest feature version of dotnet core 3.1, which is 3.1.402.

dotnet --info should start with the text:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.402
 Commit:    9b5de826fd

Observed behaviour:

The dotnet host picks the latest installed version of dotnet, which is 5.0.100-rc.1.20452.10.
The SDK version and rollForward behaviour appears to be ignored.

dotnet --info starts with the text:

.NET SDK (reflecting any global.json):
 Version:   5.0.100-rc.1.20452.10
 Commit:    473d1b592e

This issue occurs with any SDK version that is not currently installed on the machine For example, using global.json:

{
  "sdk": {
    "version": "3.1.201",
    "rollForward": "latestFeature"
  }
}

will roll forward to 3.1.402 on my local machine because SDK 3.1.201 is installed, but will jump all the way to 5.0.100-rc.1.20452.10 on our build server because SDK 3.1.201 is not present on that machine. This is problematic because the build server (and also development machines) must have all SDKs installed to account for all possible variations of global.json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions