sdk
sdk copied to clipboard
`dotnet tool install` ignores $DOTNET_ROOT and defaults to $HOME/.dotnet
Describe the bug
Despite setting the $DOTNET_ROOT environment variable to a different location, dotnet tool install --global
always installs tools to ~/.dotnet/tools
and then prints out a message that I should at it to the PATH.
To Reproduce
Further technical details
dotnet --info
clearly shows that everything is installed in /opt/dotnet
.NET SDK:
Version: 8.0.201
Commit: 4c2d78f037
Workload version: 8.0.200-manifests.3097af8b
Runtime Environment:
OS Name: void
OS Version:
OS Platform: Linux
RID: linux-x64
Base Path: /opt/dotnet/sdk/8.0.201/
.NET workloads installed:
There are no installed workloads to display.
Host:
Version: 8.0.2
Architecture: x64
Commit: 1381d5ebd2
.NET SDKs installed:
8.0.201 [/opt/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.2 [/opt/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.2 [/opt/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/opt/dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
DOTNET_ROOT is not used by tools in any way by design - it only applies to the .NET AppHost (dotnet binary) and the .NET Runtime.
If you want to install tools to a custom location, you should use the --tool-path option of dotnet tool install
to do so.
If so, has it always been that way? The guide for installing dotnet on linux says to add $DOTNET_ROOT/tools
to the PATH, implying that the tools should be installed there.
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables#net-sdk-and-cli-environment-variables says DOTNET_ROOT "Specifies the location of the .NET runtimes, if they are not installed in the default location." Why should global tools be installed to the directory of the runtimes?
If so, has it always been that way? The guide for installing dotnet on linux says to as
$DOTNET_ROOT/tools
to the PATH, implying that the tools should be installed there.
Good spot - the guidance on that page is just wrong in that case. I'll work with the team to get it corrected.
Thanks for reporting.
@d3jv Thank you for reporting. Are there any other problems?
@JL03-Yue Haven't noticed anything else yet.