Skip to content
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

dotnet tool install ... fails if environment variable RESTOREPROJECTS is set #10798

Open
robertwesterlund opened this issue Mar 7, 2020 · 0 comments
Milestone

Comments

@robertwesterlund
Copy link

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)

  1. Start a command prompt
  2. Set the environment variable RESTOREPROJECTS, for example by running the following command:
SET RESTOREPROJECTS=MyRestoreProjectsValue
  1. 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
@wli3 wli3 self-assigned this Mar 8, 2020
@wli3 wli3 added this to the Backlog milestone Mar 8, 2020
@wli3 wli3 removed their assignment Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants