繁体   English   中英

包需要 NuGet 客户端版本“2.12”

[英]Package requires NuGet client version '2.12'

我正在尝试在 Visual Studio 2012 中安装“WindowsAzure.Storage 8.0.1”,但出现错误

包需要 NuGet 客户端版本“2.12”或更高版本,但当前的 NuGet 版本是“2.8.60318.667”。

运行命令“Install-Package NuGet.Client”

Attempting to resolve dependency 'NuGet.Versioning (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Packaging (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Common (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Packaging.Core (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Packaging.Core.Types (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Frameworks (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Repositories (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.RuntimeModel (≥ 3.5.0)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 6.0.4)'.
Attempting to resolve dependency 'NuGet.ContentModel (≥ 3.5.0)'.
'NuGet.Client 3.5.0' already installed.

但我仍然收到错误。

“WindowsAzure.Storage 8.0.1”包需要 NuGet 客户端版本“2.12”或更高版本,但当前的 NuGet 版本为“2.8.60318.667”。

更新您的 NuGet 包管理器扩展。 转到Tools->Extensions and Updates并选择Updates->Visual Studio Gallery 更新 NuGet 包管理器扩展。 然后在 Visual Studio 重新启动后尝试安装包。

NuGet 2.12 仅支持 Visual Studio 2013 及更高版本。 如果您使用的是 Visual Studio 2012,那您就不走运了

当我尝试将NewtonSoft.Json nuget 包添加到我的项目时,我在 Visual Studio 2010 中遇到了这个问题。 当我尝试从 nuget 包管理器控制台运行最新版本的 nuget 包时:

PM> Install-Package Newtonsoft.Json

它导致与 OP 提到的相同的错误:

包需要 NuGet 客户端版本“2.12”或更高版本,但当前的 NuGet 版本是“2.8.60318.667”。

所以我想我会先将 Visual Studio 中的 NuGet 扩展更新到最新版本。 但是当我进入Tools -> Extensions and Updates窗口时, Updates选项卡没有显示 Nuget 扩展的任何更新。 因此,NuGet 客户端版本2.12似乎在 Visual Studio 2010 中根本不可用/不支持。 我现在已经没有选择了。

所以最后,我特意用这种方式安装了一个特定的版本( 6.0.3Newtonsoft.Json包:

PM> Install-Package Newtonsoft.Json {Your Project Name} 6.0.3

这工作成功。 在撰写本文时,该软件包的最新版本是10.0.3

因此,可能是较新版本的 nuget 包仅与最新版本的 nuget 包管理器兼容。 因此,有时明确安装较低版本的软件包可能会对您有所帮助。 如果 nuget 包不是最新版本,则旧版本的 nuget 包当然将与 Visual Studio 中的旧 nuget 扩展兼容。

此解决方案中唯一需要注意的是,您所针对的 nuget 包的较低版本中存在的功能应该足以满足您当前的项目需求。 祝你好运!

注意:虽然我已经在 Visual Studio 2010 中详细阐述了这个解决方案,但您可以针对任何 Visual Studio 版本尝试此解决方案。

我找到了这个问题的解决方案。

基本上,您在解决方案级别有一个.nuget文件夹,该文件夹包含一个可能是旧的nuget.exe文件。 许多软件包可能需要该文件的新版本。

  1. 打开此链接: https : //www.nuget.org/downloads
  2. 下载最新版本的nuget.exe
  3. 用这个新版本替换你的.nuget/nuget.exe

再试一次,我相信它会奏效。

尝试

nuget update -self

我的结果:

Checking for updates from https://www.nuget.org/api/v2/. 
Currently running NuGet.exe 2.8.7. 
Updating NuGet.exe to 5.3.1. 
Update successful.

此修复程序对我有用(我正在使用 vs 2013,不确定它是否适用于其余部分),转到工具 --> 扩展和更新,然后查找 Visual Studio 2013 的 NuGet 包管理器,将其卸载。 在左侧窗格中选择联机,这将带您到 Visual Studio 库,在右侧窗格中搜索用于 Visual Studio 2013 的 NuGet 包管理器,它将为您提供正确的安装版本。 安装它,你就可以开始了,希望这能解决问题。

Install-Package Newtonsoft.Json -Version 6.0.3

我遇到了同样的问题,我只是点击了“为此解决方案恢复 NuGet 包”。 就我而言,这解决了问题。 希望它会有所帮助。

我解决了这个问题,我的步骤如下:

1.Do what as "Mathivanan KP" said;

2.Delete the folder ".nuget", which is below your solution folder;

3.Rebuild your solution;

4.Back to your solution folder, and press "Ctrl + Z", then rebuild your solution again.

如果问题仍然存在,我认为您应该将代码从版本管理器克隆到一个新文件夹,并像以前一样执行这些步骤。

希望对你有帮助。

您正在更新错误的软件包。 更新您的 Nuget 包管理器,错误将消失。

Update-Package NuGet.VisualStudio

https://www.nuget.org/packages/NuGet.VisualStudio

我尝试了一切,但没有任何帮助。 比我将 Visual Studio 版本从 2012 年更改为 2015 年,现在一切都像魅力一样工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM