-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Make the toolsResolverCache path overridable using an environment variable. Fixes #11432. #43576
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
|
if approved, it would need documentation: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables |
I can do that if approved. |
|
@dsplaisted is this something you can approve? |
|
Due to lack of recent activity, this PR has been labeled as 'Stale'. It will be closed if no further activity occurs within 7 more days. Any new comment will remove the label. |
|
I think we probably still want this. |
…esolver-cache-overridable
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 support for overriding the default tools resolver cache path using the DOTNET_TOOLS_RESOLVER_CACHE_FOLDER environment variable, addressing issue #11432. This allows users to customize where the shim files for locally installed tools are stored, which is useful for scenarios where the default location under $HOME/.dotnet/toolResolverCache is not suitable.
Key Changes
- Modified
CliFolderPathCalculator.ToolsResolverCachePathto check theDOTNET_TOOLS_RESOLVER_CACHE_FOLDERenvironment variable before falling back to the default path - Added a test to verify the environment variable override functionality works correctly
- Updated documentation to reflect the new environment variable
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Cli/Microsoft.DotNet.Configurer/CliFolderPathCalculator.cs | Implements environment variable override for tools resolver cache path |
| test/dotnet.Tests/CommandTests/Tool/Restore/ToolRestoreCommandTests.cs | Adds test coverage for the new environment variable override |
| documentation/manpages/sdk/dotnet-tool-install.1 | Documents the new environment variable option |
| documentation/manpages/sdk/dotnet-environment-variables.7 | Adds documentation for the DOTNET_TOOLS_RESOLVER_CACHE_FOLDER variable |
| public static string ToolsResolverCachePath => Path.Combine(DotnetUserProfileFolderPath, ToolsResolverCacheFolderName); | ||
| public static string ToolsResolverCachePath => | ||
| Environment.GetEnvironmentVariable("DOTNET_TOOLS_RESOLVER_CACHE_FOLDER") ?? | ||
| Path.Combine(DotnetUserProfileFolderPath, ToolsResolverCacheFolderName); |
Copilot
AI
Dec 10, 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.
Inconsistent indentation: This line has an extra space. It should align with line 18 (12 spaces of indentation), but appears to have 13 spaces. Please adjust the indentation to match the pattern used in lines 17-18.
| Path.Combine(DotnetUserProfileFolderPath, ToolsResolverCacheFolderName); | |
| Path.Combine(DotnetUserProfileFolderPath, ToolsResolverCacheFolderName); |
| .PP | ||
| Local tools are stored in the NuGet global directory, whatever you\[cq]ve set that to be. | ||
| There are shim files in \f[V]$HOME/.dotnet/toolResolverCache\f[R] for each local tool that point to where the tools are within that location. | ||
| There are shim files in \f[V]$HOME/.dotnet/toolResolverCache\f[R] for each local tool that point to where the tools are within that location (this path can be overridden with the \f[V]DOTNET_TOOLS_RESOLVER_CACHE_FOLDER\f[R] environment variable). |
Copilot
AI
Dec 10, 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.
According to repository guidelines, files under documentation/manpages/sdk are generated and should not be manually modified. These changes should be made to the source documentation files instead, and the manpages should be regenerated from those sources.
| .SS \f[V]DOTNET_TOOLS_RESOLVER_CACHE_FOLDER\f[R] | ||
| .PP | ||
| Overrides the default location ($HOME/.dotnet/toolResolverCache) for the shim files for locally installed tools. |
Copilot
AI
Dec 10, 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.
According to repository guidelines, files under documentation/manpages/sdk are generated and should not be manually modified. These changes should be made to the source documentation files instead, and the manpages should be regenerated from those sources.
Fixes #11432.