Skip to content

[backport to release/10.0.3xx]Add warnings for newer tool versions during dotnet tool restore#52715

Merged
baronfel merged 3 commits intodotnet:release/10.0.3xxfrom
baronfel:backport/pr-51011-to-release/10.0.3xx
Mar 26, 2026
Merged

[backport to release/10.0.3xx]Add warnings for newer tool versions during dotnet tool restore#52715
baronfel merged 3 commits intodotnet:release/10.0.3xxfrom
baronfel:backport/pr-51011-to-release/10.0.3xx

Conversation

@baronfel
Copy link
Copy Markdown
Member

Manual backport of #51011 because the backport bot failed

@baronfel baronfel changed the title Backport/pr 51011 to release/10.0.3xx [backport to release/10.0.3xx]Add warnings for newer tool versions during dotnet tool restore Jan 28, 2026
@baronfel baronfel added Area-Tools cli-ux Issues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on) labels Jan 28, 2026
@baronfel baronfel added this to the 10.0.3xx milestone Jan 28, 2026
@baronfel baronfel enabled auto-merge (squash) January 28, 2026 18:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This is a manual backport of PR #51011 to the release/10.0.3xx branch, which adds warnings during dotnet tool restore to inform users when newer versions of tools are available.

Changes:

  • Added a new warning system that checks for newer versions of tools during restoration
  • Implemented smart prerelease handling: warnings only show for newer stable versions when the current version is stable, but show all newer versions when the current version is prerelease
  • Added comprehensive test coverage for version comparison scenarios

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandTests.cs Adds three comprehensive tests covering basic version warnings, prerelease-to-stable warnings, and stable-to-prerelease (no warning) scenarios
src/Cli/dotnet/Commands/xlf/*.xlf (13 files) Adds the new localized string resource "RestoreNewVersionAvailable" across all supported languages with state="new"
src/Cli/dotnet/Commands/CliCommandStrings.resx Adds the new resource string for the version warning message
src/Cli/dotnet/Commands/Tool/Restore/ToolRestoreCommand.cs Extends ToolRestoreResult struct with Warning property and updates display logic to show warnings in yellow for both success and partial failure cases
src/Cli/dotnet/Commands/Tool/Restore/ToolPackageRestorer.cs Implements CheckForNewerVersion method that queries for the latest version and applies prerelease filtering logic; passes warning through to ToolRestoreResult

@baronfel
Copy link
Copy Markdown
Member Author

/ba-g known template engine SSL issue

@baronfel baronfel requested a review from a team February 5, 2026 15:42
@baronfel
Copy link
Copy Markdown
Member Author

baronfel commented Mar 2, 2026

/ba-g known template engine errors

Copilot AI and others added 3 commits March 25, 2026 16:11
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Co-authored-by: nagilson <23152278+nagilson@users.noreply.github.com>
@baronfel baronfel force-pushed the backport/pr-51011-to-release/10.0.3xx branch from e2d6375 to 204ff84 Compare March 25, 2026 23:11
@baronfel baronfel self-assigned this Mar 25, 2026
@baronfel
Copy link
Copy Markdown
Member Author

/ba-g netanalyzers known issues

{
// If the current version is prerelease, show warning for any newer version
// If the current version is stable, only show warning for newer stable versions
if (package.Version.IsPrerelease || !latestVersion.IsPrerelease)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider an informational message if a user is on a stable version, but a new prelease is available. For example, the user is on 1.0.0, but 2.0.0-preview.1 is available?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reasonable extension of the core mechanism for sure 👍

@baronfel baronfel merged commit af7d656 into dotnet:release/10.0.3xx Mar 26, 2026
26 of 28 checks passed
@baronfel baronfel deleted the backport/pr-51011-to-release/10.0.3xx branch March 26, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Tools cli-ux Issues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants