【问题标题】:After clearing Nuget caches, every Nuget install fails [duplicate]清除 Nuget 缓存后,每次 Nuget 安装都会失败 [重复]
【发布时间】:2020-10-21 23:50:12
【问题描述】:

在最新的 Windows10 上的 VS 2017 中,我安装了 Nuget Package Manager 4.6。我刚刚清除了所有 nuget 缓存,现在如果我尝试将 Nuget 添加到任何项目,或者构建具有 nuget 依赖项的项目,我会收到下载错误。

例如

Resolving actions to install package 'Newtonsoft.Json.12.0.3'
Resolved actions to install package 'Newtonsoft.Json.12.0.3'
Retrieving package 'Newtonsoft.Json 12.0.3' from 'nuget.org'.
  GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/12.0.3/newtonsoft.json.12.0.3.nupkg
  OK https://api.nuget.org/v3-flatcontainer/newtonsoft.json/12.0.3/newtonsoft.json.12.0.3.nupkg 28ms
Installing Newtonsoft.Json 12.0.3.
Error downloading 'Newtonsoft.Json.12.0.3' from 'https://api.nuget.org/v3-flatcontainer/newtonsoft.json/12.0.3/newtonsoft.json.12.0.3.nupkg'.

我在同一台机器上的浏览器中看不到 Nuget.org 的任何问题,现在我基本上无法构建任何东西!可能是什么问题?

【问题讨论】:

  • 哪些窗口? nuget 关闭了 TLS1.0/1.1 支持。您需要 TLS 1.2 支持:devblogs.microsoft.com/nuget/…
  • W10.我使用的是包管理器而不是 Powershell,所以我读了这篇文章,因为它应该可以工作......今天早些时候它也工作了。清除缓存导致问题。
  • 啊哈,好像是这个问题:stackoverflow.com/questions/10582001/…
  • 可以在 Nuget 包管理器 UI 下访问 nuget.org 吗?
  • 我发现你使用https://api.nuget.org/v3-flatcontainer/.........作为nuget.org路径,请尝试使用这个:https://www.nuget.org/api/v2/作为nuget.org。

标签: visual-studio visual-studio-2017 nuget


【解决方案1】:

清除 Nuget 缓存后,每次 Nuget 安装都会失败

您可以尝试以下步骤来解决您的问题:

建议

1)关闭VS Instance,删除C:\Users\xxx(current user account)\AppData\Roaming\NuGet\NuGet.Config

另外,输入你的项目路径,尝试删除解决方案文件夹的.vs隐藏文件夹,binobj文件夹。然后重启VS。

2)尝试将nuget.org设置为http://packages.nuget.org/v1/FeedService.svc/https://www.nuget.org/api/v2/

Tools-->Options-->Nuget Package Manager-->Package Sources下进行测试再次。

确保您当前的代理 Internet 可以访问这些路径。

3)工具-->Nuget 包管理器--> 包管理器控制台下运行[Net.ServicePointManager]::SecurityProtocol=[Net.ServicePointManager]::SecurityProtocol-bOR [Net.SecurityProtocolType]::Tls12 > 然后安装包再次测试。

4)检查是否存在阻止nuget安装包的防火墙策略或其他代理设置。

5) 尝试在工具--> 扩展和更新下禁用任何第三方扩展,以防某些扩展与之交互。 p>

6)如果你的VS有更新,请更新。

【讨论】:

  • 建议 2 解决了我与 Install-Package : Failed to retrieve information about 'Newtonsoft.Json' from remote source: 'https://www.nuget.org/FindPackagesById()?id='Newtonsoft.Json'&semVerLevel=2.0.0' 的问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多