visual-studio - Visual Studio - Nuget - 无法加载源的服务索引

标签 visual-studio nuget nuget-package

这是我的 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/

相关文章:

json - "One or more projects are incompatible with UAP,Version=v10.0"问题 [UWP]

.net - TeamCity 不从特定包源恢复 NuGet 包

c# - 无法识别用于 silverlight 的 JSON.net 5.0 nuget 包

c++ - union 成员无效

c# - 更改文本文件中特定行中的特定文本

azure-devops - 将 NuGet 包从 TeamCity 发布到 Azure DevOps Artifacts

cmd - Chocolatey Ngrok.portable 不工作

visual-studio - 更新 nuget 包将错误条件添加到 csproj

C# 8 使用声明范围困惑

c# - 将自定义格式添加到模板参数 Visual Studio 项目