【问题标题】:Unknown NuGet Error Failed to retrieve information未知 NuGet 错误 无法检索信息
【发布时间】:2019-08-30 14:39:06
【问题描述】:

我是 Visual Studio 和 NuGet 的新手,我遇到了这个错误。

我不知道我做错了什么你能帮帮我吗?

这是我的控制台输出:

Getting restore information for project /Users/{USERNAME}/Pfeife/Pfeife/Pfeife.csproj
Getting restore information for project /Users/{USERNAME}/Pfeife/Pfeife.iOS/Pfeife.iOS.csproj
Getting restore information for project /Users/{USERNAME}/Pfeife/Pfeife.Android/Pfeife.Android.csproj
Running non-parallel restore.
Reading project file /Users/{USERNAME}/Pfeife/Pfeife/Pfeife.csproj.
Persisting no-op dg to /Users/{USERNAME}/Pfeife/Pfeife/obj/Pfeife.csproj.nuget.dgspec.json
Restoring packages for /Users/{USERNAME}/Pfeife/Pfeife/Pfeife.csproj...
Restoring packages for .NETStandard,Version=v2.0...
  GET https://api.nuget.org/v3-flatcontainer/system.net.http/index.json
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/system.net.http/index.json'.
The SSL connection could not be established, see inner exception.
  Unable to write data to the transport connection: The socket is not connected.
  The socket is not connected
  GET https://api.nuget.org/v3-flatcontainer/system.net.http/index.json
Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/system.net.http/index.json'.
The SSL connection could not be established, see inner exception.
  Unable to write data to the transport connection: The socket is not connected.
  The socket is not connected
  GET https://api.nuget.org/v3-flatcontainer/system.net.http/index.json
Failed to retrieve information about 'System.Net.Http' from remote source 'https://api.nuget.org/v3-flatcontainer/system.net.http/index.json'.

【问题讨论】:

  • 看到这个Answer
  • 您没有与 :api.nuget.org/v3-flatcontainer/system.net.http/index.json 建立安全连接。使用诸如wireshark 或fiddler 之类的嗅探器并使用标准Webbrowser 捕获第一个请求。然后使用您的 c# 代码捕获相同的结果。将标头添加到您的 c# 代码中,使其看起来像工作结果。
  • @jdweng 我只想添加 System.Net.Http 包这不是我的代码,不是吗?
  • 一个 http 请求包含标头。您的标头与服务器不兼容。使用 SSL/TLS 的安全连接可能很糟糕。使用 IE,我可以连接到服务器并查看响应。
  • 重新启动 Visaul Studio 修复了它....

标签: c# visual-studio nuget


【解决方案1】:

我只需重新启动 Visual Studio 即可解决此问题。看起来 Visual Studio for Mac 有很多 bug。

【讨论】:

    【解决方案2】:

    可能有多个根本原因,例如:

    • 项目已卸载或在当前解决方案之外
    • 项目未从项目系统提名到 NuGet
    • 不完整或损坏的恢复元数据从项目系统提名发送
    • 项目唯一名称区分大小写(最近看到一个问题)
    • 套管问题。

    总体而言,此错误意味着 NuGet 没有有关此项目的还原元数据详细信息,这就是它无法还原此项目的原因。并在更改项目依赖项后重新启动 Visual Studio 项目。

    您是否还可以检查您的案例是否与项目唯一名称的区分大小写的场景有关?只需确保项目路径和项目引用具有相同的大小写即可。

    【讨论】:

    • 在哪里可以找到项目和项目参考资料?
    • 抱歉回复晚了...在 notepad++ 或记事本中打开 project.sln 文件,您可以在其中找到参考项目
    • 另一种方式,右键单击解决方案,选择项目依赖项,在项目下拉列表中选择第一个项目,然后使用向下箭头滚动项目。对于项目框中的每个项目,查看您感兴趣的项目是否已在列表中选中
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-28
    • 2020-03-23
    • 1970-01-01
    • 2013-05-22
    • 1970-01-01
    • 2022-08-17
    • 1970-01-01
    相关资源
    最近更新 更多