Include resolved tool version in invalid DotnetToolSettings install/update errors - #54822
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix dotnet tool install to log bad version information
Include resolved tool version in invalid DotnetToolSettings install/update errors
Jun 17, 2026
baronfel
reviewed
Jun 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the dotnet tool install/update error surfaced when DotnetToolSettings.xml is missing so it includes the resolved package identity (ID + concrete version), improving diagnosability when version ranges/floating resolution are involved.
Changes:
- Update
MissingToolSettingsFileto include package ID and resolved version. - Propagate the resolved
library.Versioninto the thrownToolConfigurationExceptionvia a small helper. - Add a unit test asserting the error message includes both package name and version.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/Microsoft.DotNet.PackageInstall.Tests/ToolPackageInstanceTests.cs | Adds coverage for the new error message formatting (ID + version). |
| src/Cli/dotnet/ToolPackage/ToolPackageInstance.cs | Uses resolved library.Version and centralizes formatting in a helper method. |
| src/Cli/dotnet/CliStrings.resx | Updates the localized string template to include {0} (id) and {1} (version). |
Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
baronfel
force-pushed
the
copilot/fix-dotnet-tool-version-logging
branch
from
June 17, 2026 14:42
bf0a00f to
c595959
Compare
baronfel
approved these changes
Jun 17, 2026
baronfel
enabled auto-merge (squash)
June 17, 2026 14:43
Member
|
/ba-g unrelated flaky test failure in static web assets |
dsplaisted
approved these changes
Jun 23, 2026
dsplaisted
added a commit
that referenced
this pull request
Jun 24, 2026
ToolPackageInstanceTests.cs (added by #54822) used the xUnit [Fact] attribute, but Microsoft.DotNet.PackageInstall.Tests was migrated to MSTest.Sdk (#54822 was validated on a pre-migration base and merged without re-running CI against current main, so the incompatibility wasn't caught). The project no longer references xUnit, so [Fact] fails to compile with CS0246, breaking the build on main. Use [TestClass]/[TestMethod] to match the rest of the (MSTest) test project. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dsplaisted
added a commit
that referenced
this pull request
Jun 24, 2026
nagilson
pushed a commit
that referenced
this pull request
Jul 6, 2026
ToolPackageInstanceTests.cs (added by #54822) used the xUnit [Fact] attribute, but Microsoft.DotNet.PackageInstall.Tests was migrated to MSTest.Sdk (#54822 was validated on a pre-migration base and merged without re-running CI against current main, so the incompatibility wasn't caught). The project no longer references xUnit, so [Fact] fails to compile with CS0246, breaking the build on main. Use [TestClass]/[TestMethod] to match the rest of the (MSTest) test project. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dkurepa
pushed a commit
that referenced
this pull request
Jul 7, 2026
ToolPackageInstanceTests.cs (added by #54822) used the xUnit [Fact] attribute, but Microsoft.DotNet.PackageInstall.Tests was migrated to MSTest.Sdk (#54822 was validated on a pre-migration base and merged without re-running CI against current main, so the incompatibility wasn't caught). The project no longer references xUnit, so [Fact] fails to compile with CS0246, breaking the build on main. Use [TestClass]/[TestMethod] to match the rest of the (MSTest) test project. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dotnet tool install/updatecould surfaceDotnetToolSettings.xmlerrors without indicating which package version was actually resolved, making tool-author diagnosis harder when version selection/ranges were involved. This updates the error path to include concrete package identity details.Error payload now includes resolved package identity
MissingToolSettingsFilenow formats with package id + resolved version.Settings file 'DotnetToolSettings.xml' was not found in package '{id}@{version}'.Version propagation at throw site
ToolPackageInstance, the missing-settings exception now uses the resolvedlibrary.Version(the concrete selected version), not just package id context.Focused unit coverage
ToolPackageInstanceTeststo assert the missing-settings message includes package identity in<package>@<version>form.