我无法通过dotnet
cli安装任何全局工具。
例如,如果我运行:dotnet -d tool install -g dotnet-cleanup
我得到以下输出:
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
但是我不知道这应该告诉我什么,因为该软件包肯定没有拼写错误,它绝对是一种工具,而且我可以在浏览器中完美访问https://api.nuget.org/v3/index.json
,因此没有连接问题(至少使用此网址)。
有趣的是,文件C:\Users\USERNAME\AppData\Local\Temp\llddqege.ijr\restore.csproj
在我的系统上不存在。
那是什么问题,我该如何解决呢?
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