Resolve global.json latestMajor to the newest active release instead of LTS (#803)

* Resolve global.json latestMajor to the newest active release, not LTS

rollForward: latestMajor cleared the version, which createChannelArgument mapped to the LTS channel. When the declared sdk.version belongs to an STS release, the LTS channel is older than the declared version and the installed SDK does not satisfy global.json. Resolve it from the releases index to the newest active release of either support type, still GA only.

* Limit latestMajor resolution to global.json and enforce the minimum version

An empty version without rollForward latestMajor (for example a global.json
without sdk.version) resolves to the LTS channel again. After an online
install, the action fails if the installed SDK is older than the global.json
minimum version. The installer tests now mock the releases index instead of
calling the live service.
This commit is contained in:
Kamron Batman authored and GitHub committed 2026-11-30 11:28:00 -06:00
1 parent 84bc3a3451
commit 186fc9ae17
5 files changed
+204 -12

No files matched your search

+1 -1
View File
@@ -201,7 +201,7 @@ steps:
working-directory: csharp
```
> **Note**: The action supports `latest*` variants of the [rollForward](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json#rollforward) field in `global.json`. When set to `latestPatch`, `latestFeature`, `latestMinor`, or `latestMajor`, the action installs the appropriate SDK version. For prerelease versions, the exact pinned version is always installed regardless of the `rollForward` setting.
> **Note**: The action supports `latest*` variants of the [rollForward](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json#rollforward) field in `global.json`. When set to `latestPatch`, `latestFeature`, `latestMinor`, or `latestMajor`, the action installs the appropriate SDK version. With `latestMajor`, the action installs the newest active GA release, which can be an STS release rather than LTS; `dotnet-quality` is not applied. If the installed SDK is older than the `sdk.version` declared in `global.json`, the action fails. For prerelease versions, the exact pinned version is always installed regardless of the `rollForward` setting.
> **Important**: When using `rollForward` in `global.json`, the `sdk.version` field must be a fully-qualified SDK version (e.g., `8.0.100`, `10.0.100`). Wildcard versions (e.g., `10.0.*`) and runtime-style versions (e.g., `8.0.0`) are not supported. See the [.NET SDK version specification](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json#version) for details.