Skip to content

Reject one-part channels with a clear error - #748

Open
celinhodaltro wants to merge 1 commit into
dotnet:mainfrom
celinhodaltro:fix/one-part-channel-message
Open

celinhodaltro wants to merge 1 commit into
dotnet:mainfrom
celinhodaltro:fix/one-part-channel-message

Conversation

@celinhodaltro

@celinhodaltro celinhodaltro commented Oct 31, 2026 •

Copy link
Copy Markdown

Fixes #686.

-c 10 went all the way to the release metadata lookup and came back with Failed to resolve the exact version number. -- no hint about the format being wrong, no hint about what to type instead. -c 11 did the same thing today, so anyone reaching for the newest major version hits it too.

Both scripts now reject a one-part numeric channel right after normalization, next to the existing release/* warning: Get-NormalizedChannel throws the same style of message used for -Quality, -Runtime, --os and --quality, and get_normalized_channel prints it with say_err and returns 1, which the assignment in calculate_vars turns into an exit under set -e.

Nothing else changes: STS, LTS, A.B, A.B.Cxx and the deprecated release/* form take the same path as before.

What it looks like now:

> .\src\dotnet-install.ps1 -Channel 11 -DryRun
'11' is not a supported value for -Channel option. Supported values are: STS, LTS, a two-part version such as '10.0', or a three-part SDK feature band such as '10.0.1xx'. Did you mean '-Channel 11.0'? If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues.

$ ./dotnet-install.sh -c 11 --dry-run
dotnet_install: Error: '11' is not a supported value for --channel option. ... Did you mean '-Channel 11.0'? ...

And the paths that must keep working, run with --dry-run:

input dotnet-install.ps1 dotnet-install.sh
10.0 10.0.403 10.0.403
10.0.1xx 10.0.114 --
STS 9.0.320 9.0.320

On the test side, ScriptEncodingTests passes 2/2 (the .ps1 stayed CRLF and the .sh stayed LF) and GivenThatIWantToGetTheSdkLinksFromAScript, which shells out to both scripts for each version/channel combination, passes 143 with 8 skipped and 0 failures.

A one-part channel such as `-c 10` reached the release metadata
lookup and failed with "Failed to resolve the exact version number.",
which does not say what was wrong or what to use instead (issue dotnet#686).

Both scripts now reject the value right after normalization and list
the supported formats, including the two-part form to use instead.

Fix dotnet#686
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Improve output for unsupported one-part channel in dotnet-install.sh

1 participant