【问题标题】:Can't install discord.net - Failed to retrieve information about 'Discord.Net.Core' from remote source无法安装 discord.net - 无法从远程源检索有关“Discord.Net.Core”的信息
【发布时间】:2020-12-10 21:02:31
【问题描述】:

我过去用discord.py 制作了 Python discord 机器人,但现在我正在学习 C#,我想尝试用 discord.net 制作一个。当我尝试安装discord.net 时,我点击dependencies,然后点击NuGet 包,然后浏览并搜索discord.net。当我按下安装按钮时,我收到以下错误:

Severity    Code    Description Project File    Line    Suppression State
Error       Failed to retrieve information about 'Discord.Net.Core' from remote source 'https://github.com/DSharpPlus/DSharpPlus/FindPackagesById()?id='Discord.Net.Core'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).                

我正在使用 Visual Studio 2019。

【问题讨论】:

  • 你必须更清楚你的问题是什么
  • 错误信息告诉你到底是什么问题。

标签: c# visual-studio nuget nuget-package discord.net


【解决方案1】:

问题是您使用了私有 nuget 提要。 在该提要中,您有 Discord.Net nuget 包,但它的一些 nuget 依赖项(例如 Discord.Net.Core)在您的私有中不存在喂养。这就是问题的原因。请记住,nuget 依赖项与 nuget 主包一起安装。如果安装依赖有问题,项目中无法安装主包。

所以我建议你应该使用nuget.orgnuget 包源。

建议

1) 工具-->Nuget包管理器-->包管理器设置-->包源

检查nuget.org源,如果你的VS没有,你可以这样添加。

2)然后在manage nuget packages UI下,请选择nuget.org来安装那个包。

=============================================

更新 1

关闭VS,删除C:\Users\xxx(current user)\AppData\Roaming\NuGet下的nuget.config

然后,重启VS,然后安装nuget包就可以了。

【讨论】:

  • 我已按照您的步骤进行操作,我的 nugget.org 框已打勾,因此我尝试取消选中它,然后保存然后重新检查,但我仍然收到相同的错误。
  • 很奇怪,我身边没有遇到同样的问题。请尝试以下两个建议:1)关闭VS,删除C:\Users\xxx(current user)\.nuget\packages下的所有缓存文件,同时进入项目文件夹,删除binobj文件夹。然后,重新启动您的项目以再次测试。 2)关闭VS,删除C:\Users\xxx(current user)\AppData\Roaming\NuGet下的nuget.config文件,然后重启你的项目再次测试。
  • @MaxMcCarthy,有关于这个问题的更新吗?如果我的回答能帮助您解决问题,请不要忘记accept it。如果没有,请随时告诉我们:)
  • 我查看了我的文件夹,但在我的电脑上的任何地方都找不到.nuget。我现在很困惑。我已经重新安装了 Visual Studio 2019,但同样的问题不断发生。我做错了什么?
  • 文件夹在您当前用户的文件夹下。或者您可以使用 VS UI 来清理 nuget 缓存。输入Tools-->Options-->Nuget Package Manager-->General-->Clear All Nuget Caches
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-21
  • 1970-01-01
  • 2013-08-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多