【发布时间】:2022-11-01 14:54:28
【问题描述】:
我的解决方案中有私有 nuget repo 包,当我恢复它们以在 Visual Studio 中构建我的应用程序时,出现以下错误
Severity Code Description Project File Line Suppression State
Error NU1301 Unable to load the service index for source https://myprivate.privatenuget.org/F/privatepackages/api/v3/index.json. MyPrivate.Project.Repository C:\Pth\To\source\repos\Project\src\Project.name\Project.csproj 1
以流行的分辨率
Nuget connection attempt failed "Unable to load the service index for source" 我尝试删除 %AppData%\Roaming\NuGet\NuGet.Config 并重新启动对我不起作用的 VS。
我的 Nuget.Config 看起来像这样。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="MyGet.orgV3" value="https://myprivate.privatenuget.org/F/privatepackages/api/v3/index.json" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageManagement>
<add key="format" value="1" />
<add key="disabled" value="False" />
</packageManagement>
</configuration>
甚至尝试过dotnet restore --interactive
但徒劳无功
dotnet restore --interactive
Determining projects to restore...
C:\Pth\To\source\repos\Project\src\Project.name\Project.csproj : error NU1301: Unable to load the service index for source https://myprivate.privatenuget.org/F/privatepackages/api/v3/index.json. [C:\Pth\To\source\repos\Project\src\Project.name\Project.csproj]
存储库需要密码/AzureAAD 身份才能访问,并且我已使用可以访问私有存储库的帐户登录到 Visual Studio/终端。我认为这以某种方式阻止了服务索引的加载,但我有一个实现它的障碍。
【问题讨论】:
标签: asp.net .net visual-studio visual-studio-2022 nuget-package-restore