这是我的 NuGet.config :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<disabledPackageSources>
<add key="Microsoft and .NET" value="true" />
</disabledPackageSources>
</configuration>
现在,在 Visual Studio 中,当我尝试安装“geckofx45”包时,出现以下错误:
install-package geckofx45 install-package : Unable to load the service index for source https://api.nuget.org/v3/index.json. At line:1 char:1 + install-package geckofx45 + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
你有什么解决方案 ?
先感谢您
最佳答案
Visual Studio - Nuget - Unable to load the service index for source
这是一个常见错误,我们无法从此错误消息中获得很多有用的信息。我们只能提供此问题的故障排除。
出现这个问题的原因大部分是因为网络问题或者
nuget.config
中的配置不正确。 .为确定此问题是否与VS IDE、网络或其他有关,请先打开nuget服务器的路径
https://api.nuget.org/v3/index.json
在浏览器中。如果你能在浏览器中打开它,这个问题可能更多地与 VS IDE/nuget.config 相关。您可以删除 nuget.config
在 %appdata%\Nuget
,然后重新启动 Visual Studio 以生成新的 nuget.config
.其次,如果你在浏览器中也打不开,这个问题可能与网络问题有关,你应该检查你是否有代理变量
http_proxy
在我们的系统变量或 IE 浏览器中,我们可以在具有相同网络的另一台 PC 上测试它。如果您的 PC 中有代理设置,您可以将其删除以进行测试,或者您可以将代理设置添加到 Nuget.Config 文件中。详情请引用此链接:Nuget Config Section & Nuget Proxy Settings .在我们确认我们的 PC 中没有任何代理后,我们应该检查我们的网络是否有限。我们可以用不同的网络来测试它。见 the same issue了解更多详情。
关于visual-studio - Visual Studio - Nuget - 无法加载源的服务索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49773500/