在VS2012“缺少软件包"中使用nuget时出错. [英] Error using nuget in VS2012 "missing packages"

查看:217
本文介绍了在VS2012“缺少软件包"中使用nuget时出错.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从VS2012中构建项目时,出现以下错误消息

When I build my project from within VS2012 I get the following error message

This project references NuGet package(s) that are missing on this computer. 
Enable NuGet Package Restore to download them. 

我为NuGet设置了nuget选项,以下载丢失的软件包.

I have the nuget options set for NuGet to download missing packages.

但是我仍然会收到错误消息. 我已经安装了块金2.7.使用VS2012 Update 3

Yet I still get the error. I have nugget 2.7 installed. With VS2012 update 3

推荐答案

正如Dan所提到的,如果您的解决方案具有.nuget文件夹(通过启用程序包还原),则nuget 2.7的自动程序包还原功能将被禁用,根据 http://docs.nuget.org/docs/workflows/migrating-to-自动打包恢复.

As Dan was alluding to, if your solution has a .nuget folder (from enabling package restore), then nuget 2.7's automatic package restore feature is disabled, as per http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore.

如果禁用了自动程序包还原,则任何安装项目目标文件的程序包都将导致构建失败,直到您在解决方案中手动还原该程序包为止,如 http://blogs.msdn.com/b/dotnet/archive/2013/06/12/nuget- package-restore-issues.aspx . (请注意,由于nuget 2.7自动软件包还原可用,因此链接中描述的解决方法已过时.)

If automatic package restore is disabled, then any package that installs a project target files will cause your build to fail until you manually restore that package in your solution, as described by http://blogs.msdn.com/b/dotnet/archive/2013/06/12/nuget-package-restore-issues.aspx. (Note that the workarounds described in the link are out-dated now that nuget 2.7 automatic package restore is available.)

因此,如果这两个条件都成立,则删除.nuget文件夹中的NuGet.targets文件,然后Nuget将在调用MSBuild之前还原丢失的程序包.您也可以在.nuget文件夹中删除nuget.exe,因为它将不再使用.

So, if both these things are true, then delete the NuGet.targets file in the .nuget folder, and Nuget will then restore the missing package before invoking MSBuild. You can delete nuget.exe in the .nuget folder as well, as it will no longer be used.

这篇关于在VS2012“缺少软件包"中使用nuget时出错.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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