dotnet tool install ...
fails if environment variable RESTOREPROJECTS is set
#10798
Milestone
dotnet tool install ...
fails if environment variable RESTOREPROJECTS is set
#10798
Description
If the environment variable
RESTOREPROJECTS
is used in the environment, thedotnet tool install ...
command fails, since the tool nuget package is ignored bynuget.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 ofRESTOREPROJECTS
. However, as a user of thedotnet 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 adotnet 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)
RESTOREPROJECTS
, for example by running the following command: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:
Environment Data
dotnet --info
output:The text was updated successfully, but these errors were encountered: