-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
If the environment variable RESTOREPROJECTS is used in the environment, the dotnet tool install ... command fails, since the tool nuget package is ignored by nuget.targets.
This is correct behaviour for the nuget.targets file, to respect the environment variable and ignore projects which are not included in the list of RESTOREPROJECTS. However, as a user of the dotnet tool install ... CLI command, I would expect the CLI to override this filter and install the tool correctly.
This problem was identified in our CI pipeline, when an environment variable had, for a long time, been named RESTOREPROJECTS. When the pipeline was updated to include a dotnet tool install ... call, this call failed with an error message stating that the file could not be found (see the heading Observed Behaviour below for the full error received).
Steps to Reproduce (windows)
- Start a command prompt
- Set the environment variable
RESTOREPROJECTS, for example by running the following command:
SET RESTOREPROJECTS=MyRestoreProjectsValue
- Install the desired tool using the following command:
dotnet tool install --tool-path . dotnetsay
Expected Behaviour
Preferably, the tool should have been installed (overriding the environment variable value by setting the value of the RESTOREPROJECTS variable when calling MSBuild for NuGet restore).
Alternatively, at least an error message stating that the tool was not installed due to the value of the environment variable RESTOREPROJECTS which ensured NuGet ignored downloading the tool.
Last alternative and least positive approach would be to update the page at https://aka.ms/failure-installing-tool to include information about this environment variables effect.
Observed Behaviour
The following error message is displayed to the user:
Failed to install tool package 'dotnetsay': Could not find a part of the path 'C:\dotnet-tool-install-restoreprojects-repro\.store\.stage\1fnbkqjy.fil\dotnetsay'.
Tool 'dotnetsay' failed to install. This failure may have been caused by:
* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
Environment Data
dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33