-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add warnings for newer tool versions during dotnet tool restore
#51011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
dotnet tool restore
should provide warnings if new versions of tool is availabledotnet tool restore
@baronfel I tested and this new code only runs if the current version of the tool is not found in the cache. That seems like an ok compromise to me as otherwise, we're hitting the network when theoretically we don't need to. However, it does mean that if you have the tool installed locally, you'll never get the notice. |
|
That's an interesting compromise for sure. I could see a |
or a flag to dotnet tool restore which asks for the check. Either way, this change is reasonable and working as is so published for review. |
There was a problem hiding this 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 PR adds functionality to display warnings when newer versions of tools are available during dotnet tool restore
operations. This helps users stay informed about tool updates and prevent compatibility issues with newer SDKs.
Key Changes:
- Enhanced restore functionality to check for newer tool versions and display warnings
- Added localized warning messages for the new version notification feature
- Implemented comprehensive test coverage for the warning functionality
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 13 comments.
Show a summary per file
File | Description |
---|---|
ToolPackageRestorer.cs |
Added version checking logic and warning generation functionality |
ToolRestoreCommand.cs |
Enhanced result structure and display logic to show version warnings |
CliCommandStrings.resx |
Added the new localized message string for version warnings |
Multiple .xlf files |
Added localization entries for the new warning message |
ToolRestoreCommandTests.cs |
Added comprehensive test coverage for the warning functionality |
</trans-unit> | ||
<trans-unit id="RestoreNewVersionAvailable"> | ||
<source>A newer version of tool '{0}' is available (version '{1}'). Consider updating your manifest file.</source> | ||
<target state="new">A newer version of tool '{0}' is available (version '{1}'). Consider updating your manifest file.</target> |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .xlf files should be updated using the /t:UpdateXlf
MSBuild target rather than manually adding entries. These manually added entries have the incorrect state 'new' instead of 'needs-review-translation'.
Copilot generated this review using guidance from repository custom instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nagilson do you know if your instruction update PR will help as all of these reviews seem wrong to me? https://github.com/dotnet/sdk/pull/51158/files
New seems fine and new is listed in the copilot instructions as fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intention wasn't to give copilot instructions but to make a github actions workflow where we could type /updatexlf and it would suggest changes based on the results of running that command. And same for /fixcompletions to fix those tests. #51158
I like the idea of updating the copilot instructions as well though. But the PR AI isn't very good from my perspective, so it may not help. It's worth trying!
I saw this and immediately worried about such a warning getting triggered in an automated build, being parsed by Jenkins and causing the build to be considered UNSTABLE. It looks like the output is not actually formatted anything like "warning SDK0000: tool is not the latest available version" though, so it won't be parsed as a warning. Please call it a note, then. |
@KalleOlaviNiemitalo yeah, this in the bucket of CLI messages so shouldn't impact exit codes or builds. It can impact if someone is processing the output. |
Summary
This PR enhances
dotnet tool restore
to show warnings when newer versions of tools are available in the configured package sources. This helps users stay informed about available updates and can prevent issues where outdated tools cause compatibility problems with newer SDKs.Changes
Core Functionality
Warning
property to carry version update notificationsCheckForNewerVersion()
method inToolPackageRestorer
that:*
) to query the latest available version from package sourcesPrintConclusionAndReturn()
to display warnings in yellow text after successful restore messagesUser Experience
RestoreNewVersionAvailable
resource string with clear, actionable messagingdotnet tool restore
, never during tool executionExample Output
Before:
After:
Testing
Behavior Notes
.config/dotnet-tools.json
filesThis addresses the scenario described in the issue where CI systems fail due to outdated tools, but users aren't aware that newer compatible versions are available.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.