NuGet 检索软件包元数据。

48
从 'nuget.org' 源检索 'bootstrap.3.3.5' 包元数据时出现了错误。 ========== 已完成 ==========

Screenshot

在nuget.org网站上下载实体框架包时,可能会出现缺陷导致崩溃,或者问题是本地的。我正在使用Windows上的Visual Basic。当他想要下载实体框架包时,缺陷开始出现,但他不接受来自官方网站包的nuget下载。
是否有对所发生情况的解释?
这意味着当我使用Visual Basic设计网站并通过asp.net Web应用程序处理数据库时,在Visual Basic中安装软件包时,我遇到了以前图片中的错误,并且知道我去https://www.nuget.org页面请求安装NuGet.exe,但无法下载。问题是电脑还是公共的。
检索包元数据时发生错误。
我注意到Visual Studio 2015 NuGet Package Manager有更新到版本3.1.60724.766(当前为3.0.60624.657),因此我下载并安装了它。同样的错误。
修复方法:
在Visual Studio 2015中,
工具菜单-> NuGet Package Manager-> Package Manager Settings
点击Package Sources

点击 + 号

添加以下内容:

名称: 类似于 NuGet v2

来源: https://www.nuget.org/api/v2/

取消选中当前的 nuget.org,这样它应该看起来像: look like

现在,您应该能够安装 NuGet 包

&&

每个软件包的许可证都由其所有者授权给您。 Microsoft 不对第三方软件包负责,也不授予任何许可证。某些软件包可能包含受其他许可证管理的依赖项。请跟随软件包源(feed)URL 以确定任何依赖关系。
软件包管理器控制台主机版本 3.0.0.0
键入“get-help NuGet”以查看所有可用的 NuGet 命令。
PM> get-help NuGet 主题 about_NuGet
简要说明 提供有关 NuGet 包管理器命令的信息。
详细说明 本主题描述了 NuGet 包管理器命令。NuGet 是一个集成的软件包管理工具,用于向 .NET 项目添加库和工具。
The following NuGet cmdlets are included.

    Cmdlet                  Description
    ------------------      ----------------------------------------------
    Find-Package            Get the set of packages available from the package source, 
                            based on the package Id/keyword. This is a new command that
                            will replace Get-Package -ListAvailable.

    Get-Package             Gets the set of installed packages. With -Updates switch, 
                            gets the set of package updates available from the package source.

    Install-Package         Installs a package and its dependencies into the project.

    Uninstall-Package       Uninstalls a package. If other packages depend on this package, 
                            the command will fail unless the –Force option is specified.

    Update-Package          Updates a package and its dependencies to a newer version.

    Sync-Package            Get the version of installed package from specified/default project
                            and sync the version to the rest of projects in the solution.

    Add-BindingRedirect     Examines all assemblies within the output path for a project
                            and adds binding redirects to the application (or web) 
                            configuration file where necessary.

    Get-Project             Returns a reference to the DTE (Development Tools Environment) 
                            for the specified project. If none is specifed, returns the 
                            default project selected in the Package Manager Console.

    Open-PackagePage        Open the browser pointing to ProjectUrl, LicenseUrl or 
                            ReportAbuseUrl of the specified package.

    Register-TabExpansion   Registers a tab expansion for the parameters of a command.

参见 在线文档: ht tp://g o .m icrosoft . com / fwlink /? LinkID=206619 Find-Package Get-Package Install-Package Uninstall-Package Update-Package Sync-Package Add-BindingRedirect Get-Project Open-PackagePage Register-TabExpansion PM>

所有这些,服务仍然无法工作


1
欢迎来到 Stack Overflow。我已经修复了您的帖子中的英语问题。请确认这就是您想要表达的内容。我还将图片嵌入到了正文中。 - Rohit Gupta
感谢Rohit的支持。我的意思是,当我使用Visual Basic设计网站并通过asp.net Web应用程序处理数据库时,当我通过附加的NuGet在Visual Basic中安装包时,我遇到了之前图片中显示的错误。我去https://www.nuget.org页面询问安装NuGet.exe,但无法下载。这是计算机的问题还是公共问题?希望我已经成功地解释了这个问题。 - Sultan
5个回答

67

这需要两个步骤(第二个步骤可能是可选的,但我总是喜欢干净的解决方案)

  1. 在资源管理器中打开项目所在的文件夹。 使用记事本打开packages.config文件。 找到并删除提到损坏软件包名称的那一行。

  2. 打开解决方案所在的文件夹。 打开子文件夹"packages"。 找到带有损坏软件包的文件夹并将其删除。

注意:如果您删除了错误的软件包,请在Visual Studio "选项"中启用NuGet还原,在启用状态下,右键单击解决方案并选择“恢复缺少的NuGet软件包”。


谢谢。我在安装NuGet包期间,留下了一个有语法错误的未保存文件,导致遇到了这个问题。显然,VS对此并不宽容... - Demonslay335

41

我的问题是由于过时的包管理器引起的。进入VS菜单工具 > 扩展和更新 > 更新,并检查是否有NuGet Package Manager的更新。安装最新版本解决了我的问题。

PS:像Hrvoje Matić建议的那样删除包引用并不能治愈头痛,而只是通过切断头部来缓解痛苦-这些包将不再可管理。


9

最近我遇到了同样的问题,发现我的nuget.exe是2.*版本。我认为它与nuget feed v3不兼容。

所以我通过将nuget.exe简单升级到3.*版本来解决此问题。


4
如果您已经使用NuGet 3,请通过VS中的“工具>扩展和更新”菜单进行更新,它应该出现在左侧的“更新”选项卡下。 - MrLore

0

在Visual Studio中打开解决方案 -> 导航到packages.config文件 1/ 复制错误控制台中看到的损坏包的package属性。从package元素中删除该损坏的package属性 2/ 保存packages.config文件,然后运行nuget命令 3/ 成功后,将package属性放回原处


0
更一般地说,在我的情况下,这是NUnit 3.8.1的问题。我降级到了早期版本的NUnit,问题就解决了。我没有时间去调查原因。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接