Dotnet tool command doesn't respect nuget packages path #15306
Description
Description
It's possible to change the path for nuget packages globally by setting NUGET_PACKAGES
environment variable (there're other means of achieving it check the documentation for details) .
Once that done dotnet tool
fails to start local tool. I guess it happens as tool was actually restored to nonstandard path, dotnet tool
is not able to find it there and consistently asks to run dotnet tool restore
.
Steps
- Set
NUGET_PACKAGES
environment variable to some directory other than default%userprofile%/.nuget/packages
- Initialize tool manifest by running
dotnet new tool-manifest
- Install some tool, e.g
dotnet tool install paket
- Try to run tool, e.g
dotnet paket init
Expected result
Tool is invoked (which is paket init
in current case)
Actual result
Error message saying Run "dotnet tool restore" to make the "paket" command available.
Running restore as suggested doesn't help. But everything works as expected after I manually move tool from the directory it was restored to to the %userprofile%/.nuget/packages
.
Haven't checked whether the same is actual for global tool installation, but would guess it is.
Environment
.NET SDK (reflecting any global.json):
Version: 5.0.101
Commit: d05174dc5a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.101\
Host (useful for support):
Version: 5.0.1
Commit: b02e13abab
.NET SDKs installed:
3.1.404 [C:\Program Files\dotnet\sdk]
5.0.101 [C:\Program Files\dotnet\sdk]
Activity