Skip to content

Conversation

@guoyongchang
Copy link

Source Issue:

Background

  • User nuget.config overrides globalPackagesFolder.
  • dotnet tool restore respects the override and places tool binaries in the custom cache, but dotnet tool run still looks in the default location.
  • Manifest/shim entries point to that stale path, so the CLI insists on “Run dotnet tool restore…” even immediately after a restore.

Root Cause

  • LocalToolsResolverCache.Save only appended new entries. When the same command ID was saved again (after restore into a new cache), the earlier row remained untouched, so the resolver kept resolving to the old executable path.

Fix Summary

  • Rework LocalToolsResolverCache.Save to overwrite an existing cache row when the RestoredCommandIdentifier matches, otherwise append a new row.
  • Add regression test GivenExecutableIdentifierItUpdatesExecutablePathOnSubsequentSave to confirm the cache returns the freshly saved executable path.

Impact

  • Local tools now honor changes to globalPackagesFolder without requiring manual cache cleanup or reinstalling tools.
  • dotnet tool run succeeds immediately after restore when the package cache directory moves.

@guoyongchang
Copy link
Author

@dotnet-policy-service agree

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant