1

I am unable to install any global tools via the dotnet cli.

For example if I run: dotnet -d tool install -g dotnet-cleanup

I get the following output:

Telemetry is: Enabled
Running C:\Program Files\dotnet\dotnet.exe restore C:\Users\USERNAME\AppData\Local\Temp\llddqege.ijr\restore.csproj --runtime any -verbosity:quiet
Process ID: 14308
Telemetry is: Enabled
C:\Program Files\dotnet\sdk\3.1.302\NuGet.targets(128,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\Users\USERNAME\AppData\Local\Temp\llddqege.ijr\restore.csproj]
C:\Program Files\dotnet\sdk\3.1.302\NuGet.targets(128,5): error :   Response status code does not indicate success: 407 (authenticationrequired). [C:\Users\USERNAME\AppData\Local\Temp\llddqege.ijr\restore.csproj]
Microsoft.DotNet.ToolPackage.ToolPackageException: The tool package could not be restored.
   at Microsoft.DotNet.Tools.Tool.Install.ProjectRestorer.Restore(FilePath project, PackageLocation packageLocation, String verbosity)
   at Microsoft.DotNet.ToolPackage.ToolPackageInstaller.<>c__DisplayClass5_0.<InstallPackage>b__0()
   at Microsoft.DotNet.Cli.TransactionalAction.Run[T](Func`1 action, Action commit, Action rollback)
   at Microsoft.DotNet.ToolPackage.ToolPackageInstaller.InstallPackage(PackageLocation packageLocation, PackageId packageId, VersionRange versionRange, String targetFramework, String verbosity)
   at Microsoft.DotNet.Tools.Tool.Install.ToolInstallGlobalOrToolPathCommand.Execute()
The tool package could not be restored.
Tool 'dotnet-cleanup' 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

But I have no idea what this should tell me because the package is definitely not spelled wrong, it also is definitely a tool and I can perfectly visit https://api.nuget.org/v3/index.json in my browser, so no connection problem (at least with this url).

Also interestingly the file C:\Users\USERNAME\AppData\Local\Temp\llddqege.ijr\restore.csproj does not exist on my system.

So what is wrong and how can I solve this problem?

Output for dotnet --info:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.302
 Commit:    41faccf259

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.302\

Host (useful for support):
  Version: 3.1.6
  Commit:  3acd9b0cd1

.NET Core SDKs installed:
  2.1.808 [C:\Program Files\dotnet\sdk]
  3.1.302 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
Ackdari
  • 3,222
  • 1
  • 16
  • 33
  • Your browser might use different proxy settings. If you are behind a proxy maybe have a look at this: https://stackoverflow.com/questions/9232160/nuget-behind-a-proxy – StefanFFM Jul 27 '20 at 07:43
  • Why do you need `-d` switch? Also, which `dotnet` versions do you have a nuget sources? – Pavel Anikhouski Jul 27 '20 at 07:54
  • @PavelAnikhouski _"Why do you need `-d` switch?"_ because I though someone would inevitably ask to run it with `-d`. _"Also, which dotnet versions do you have a nuget sources?"_ added the output of `dotnet --info` to the question. – Ackdari Jul 27 '20 at 07:58
  • @Stefan I am behind some comporate proxy (at least my windows settings suggest it), so I will look into that – Ackdari Jul 27 '20 at 08:01
  • @PavelAnikhouski from `dotnet --help` -> `-d|--diagnostics Enable diagnostic output.` – Ackdari Jul 27 '20 at 08:01
  • @Stefan your were right I configured the proxy server like suggested in [this](https://stackoverflow.com/a/15463892/6560579) (without adding my password) answer and now it works. – Ackdari Jul 27 '20 at 08:13

0 Answers0