【问题标题】:Unable to load the service index for source https://tc.xxx.yyy.intra/httpAuth/app/nuget/v1/FeedService.svc/无法加载源 https://tc.xxx.yyy.intra/httpAuth/app/nuget/v1/FeedService.svc/ 的服务索引
【发布时间】:2019-06-16 21:06:44
【问题描述】:

在构建从工作存储库克隆的解决方案时,我收到以下错误。事实上,url https://tc.xxx.yyy.intra/httpAuth/app/nuget/v1/FeedService.svc/ 已正确添加为 NuGet 中的包源(根据 Visual Studio)。

https://tc.xxx.yyy.intra/httpAuth/app/nuget/v1/FeedService.svc/: Unable to load the service index for source https://tc.xxx.yyy.intra/httpAuth/app/nuget/v1/FeedService.svc/.
  An error occurred while sending the request.
  The remote name could not be resolved: 'tc.xxx.yyy.intra'
  https://api.nuget.org/v3/index.json: Package 'ServiceLocatorAnalyzer.1.0.6533.24990' is not found on source 'https://api.nuget.org/v3/index.json'.
  https://www.nuget.org/api/v2/: Package 'ServiceLocatorAnalyzer.1.0.6533.24990' is not found on source 'https://www.nuget.org/api/v2/'.
. Please see Error List window for detailed warnings and errors.

但是,在检查我的 AppData 文件夹中的 NuGet.config 文件(如下)后,我可以看到其中只添加了 1 个 NuGet 包源,而根据 VS 有 5 个:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

这是预期的行为吗?

我还删除了 NuGet.config 文件;像这里提到的VS2015 nuget package manager not finding packages 那样重新启动了我的VS,但它没有用。

知道我哪里出错了吗?

【问题讨论】:

    标签: asp.net nuget


    【解决方案1】:

    how settings are applied documentation 中所述,可以读取许多 nuget.config 文件。其中之一是指定额外的来源。

    如果您从 nuget.org/downloads 下载 nuget.exe 并使用 nuget restore,它应该列出所有适用的 nuget.config 文件,尽管只有在没有发生致命错误时才会发生这种情况(我不确定如果无法访问的源是致命的)。如果是这样,如果您安装了 .NET Core SDK,请使用 dotnet new nugetconfig,因为 nugetconfig 模板会清除所有其他配置源并仅添加 nuget.org。那么当您恢复时(如果您有一个 .net 核心项目,请使用 dotnet restore -v n,因为默认的详细程度最低),所有 nuget.config 文件都将被列出,即使它们的源不是。

    获得用于还原的 nuget.config 文件列表后,逐一打开它们,直到找到定义错误包源的文件。

    【讨论】:

      猜你喜欢
      • 2018-09-21
      • 1970-01-01
      • 1970-01-01
      • 2022-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-03
      相关资源
      最近更新 更多