gpt4 book ai didi

visual-studio-code - dotnet restore 给出 401, "Unable to load the service index"

转载 作者:行者123 更新时间:2023-12-01 13:30:56 25 4
gpt4 key购买 nike

在一个新的 netcore20 项目中,我正在使用 dotnet test这是第一次,这将恢复和构建,并且它的恢复部分失败了。

我是第一次使用 Visual Studio Code。

"C:\Data\Git\PDQShockerRestAPI\src\PDQShockerRestAPIWebApp.UnitTests\PDQShockerRestAPIWebApp.UnitTests.csproj" (Restore target) (1) ->
(Restore target) ->
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : Unable to load the service index for source https://contoso-pdq.pkgs.visualstudio.com/_packaging/ContosoPDQNetFramework/nuget/v3/index.json.\r [C:\Data\Git\PDQShockerRestAPI\src\PDQShockerRestAPIWebApp.UnitTests\PDQShockerRestAPIWebApp.UnitTests.csproj]
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\Data\Git\PDQShockerRestAPI\src\PDQShockerRestAPIWebApp.UnitTests\PDQShockerRestAPIWebApp.UnitTests.csproj]

我已经复制了 .nuget文件夹从另一个解决方案到 /src/.nuget在这个解决方案中,但它不起作用。

我的预感是 VS2017 可能是通过 IDE 自动进行身份验证的,而 VSCode 不是?

最佳答案

该提要在 VSTS 上。我需要为 VSTS 下载并运行 NuGet 身份验证助手工具。

https://www.visualstudio.com/en-us/docs/package/nuget/auth-old

在对我的 /src/.nuget/NuGet.config 运行该工具后我看到一个迷你登录浏览器窗口并登录到 VSTS。几秒钟后它完成了,当我尝试时 dotnet test又好了。

PS C:\Data\Git\PDQShockerRestAPI\src\.nuget> ./VSS.NuGet.AuthHelper.exe -Config .\NuGet.Config
Getting new credentials for source:VSO Libraries Feed, scope:vso.packaging_write vso.drop_write

有趣的是,没有对 NuGet.config 进行任何更改。我指定的文件..!

关于visual-studio-code - dotnet restore 给出 401, "Unable to load the service index",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45966661/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com