如何使用Visual Studio 2017升级NuGet? [英] How to upgrade NuGet with Visual Studio 2017?

查看:394
本文介绍了如何使用Visual Studio 2017升级NuGet?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了升级NuGet所需的构建错误:

I'm getting a build error that I need to upgrade NuGet:


'Microsoft.NETCore.Platforms 1.1.0'软件包要求NuGet客户端
版本为'2.12'或更高版本,但当前的NuGet版本为
'2.8.60318.667'。

The 'Microsoft.NETCore.Platforms 1.1.0' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.60318.667'.

根据我在VS中在线发现的信息,我应该去工具>扩展和更新。我应该在更新标签中看到一个用于升级NuGet的选项。如您所见,该选项不存在:

From what I've found online, within VS, I'm supposed to go to Tools > Extensions and Updates. And I'm supposed to see an option to upgrade NuGet within the Updates tab. As you can see, that option isn't there:

我的解决方案有一个 .nuget 文件夹,并且其中有 NuGet.exe ,其中有一个2.8.x版本。如何升级到2.12?

My solution has a .nuget folder, and it has NuGet.exe in it, which has a version of 2.8.x. How can I upgrade to 2.12?

推荐答案


如何使用Visual Studio 2017升级NuGet

How to Upgrade NuGet with Visual Studio 2017

那是因为您在解决方案级别有一个 .nuget 文件夹,所以该文件夹包含一个旧的(2.8.x) nuget.exe 文件。许多软件包可能需要该文件的新版本。您应该更新它:

That because you have a .nuget folder at solution level, that folder contains an old (2.8.x) nuget.exe file. A lot of packages might need new version of that file. You should update it:


  1. 打开此链接: https://www.nuget.org/downloads ,切换到 Windows x86命令行标签,下载3.3或更高版本。

  2. 下载最新版本的nuget.exe

  3. 用此新版本替换.nuget / nuget.exe。

  1. Open this link: https://www.nuget.org/downloads, switch to the Windows x86 Commandline tab, download 3.3 or above.
  2. Download latest version of nuget.exe
  3. Replace your .nuget/nuget.exe with this new version.

然后重试。

此外,您的解决方案还使用了已弃用的旧nuget恢复方法。自动打包还原是NuGet团队推荐的Visual Studio中打包还原的方法,它是NuGet 2.7中引入的。从NuGet 2.7开始,NuGet Visual Studio扩展集成到Visual Studio的构建事件中,并在构建开始时恢复丢失的软件包。

Besides, your solution is using an old nuget restore method that has been deprecated. Automatic Package Restore is the NuGet team's recommended approach to Package Restore within Visual Studio, and it was introduced in NuGet 2.7. Beginning with NuGet 2.7, the NuGet Visual Studio extension integrates into Visual Studio's build events and restores missing packages when a build begins.

查看此线程 NuGet自动软件包还原不适用于MSBuild Nuget:从启用程序包还原切换到自动程序包还原 以获取更多详细信息。

See this thread NuGet auto package restore does not work with MSBuild and Nuget: Switching from "Enable Package Restore" to "Automatic Package Restore" for some more details.

希望这会有所帮助。

这篇关于如何使用Visual Studio 2017升级NuGet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆