Nugets 安装在 Visual Studio 2015 中 [英] Nugets install in visual studio 2015

查看:21
本文介绍了Nugets 安装在 Visual Studio 2015 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 Visual Studio 2015 中的简单项目中安装 nuget Microsoft.VisualStudio.QualityTools.UnitTestFramework 并收到此消息:

I try to install the nuget Microsoft.VisualStudio.QualityTools.UnitTestFramework in Visual Studio 2015 in simple project and got this message:

无法安装包Microsoft.VisualStudio.QualityTools.UnitTestFramework 10.0.30319.1".您正在尝试将此包安装到以.NETFramework,Version=v4.5.2"为目标的项目中,但该包不包含任何与该框架兼容的程序集引用或内容文件.有关更多信息,请联系软件包作者.

Could not install package 'Microsoft.VisualStudio.QualityTools.UnitTestFramework 10.0.30319.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

但是,当我尝试在同一项目中的 Visual Studio 2013 中安装此包时,这是可行的.

But, when I try to install this package in Visual Studio 2013 in the same project this is work.

如何在 Visual Studio 2015 中安装此 nuget?

How can I install this nuget in Visual Studio 2015?

推荐答案

时间过去了,却发生在我身上,发现与框架版本无关.错误消息的重要文本是:...但包不包含任何程序集引用或内容文件...".

Time has passed, but it is happening to me, and I have found that it has nothing to do with the framework version. The important text of the error message is: "...but the package does not contain any assembly references or content files...".

确实,我的包没有任何 Nuget 可见内容:它有一个非常规文件夹,其中包含第三方本机库和一个 Install.ps1,它使用 Xcopy 命令添加后期构建事件.

Indeed, my package does not have any visible content for Nuget: it has a non conventional folder with third party native libraries and a Install.ps1 that adds a post build event with a Xcopy command.

作为一个简单的周转,只需在包Content文件夹中放置一个虚拟文件或lib中的任何其他虚拟内容,空文件节点(未尝试过)等.

As an easy turnaround, just put a dummy file in the package Content folder or any other dummy content in lib, empty file node (not tried it), etc.

编辑 29/5/2017

EDIT 29/5/2017

我发现这个答案对其他人有用,这就是我要详细说明的原因.

I am seeing that this answer is useful to others, and that is why I am going to elaborate a little more.

正如我所说,问题是Nuget看不到包中有任何内容,但可能有两个原因:

As I said, the problem is that Nuget don't see there is any content in the package, but it may have two causes:

  1. 包确实没有可见内容,因为它使用脚本等移动内容(就像我的情况一样),然后有必要创建一些虚拟内容作为解决方法.

  1. The package really does not have visible content because it moves the content with a script, etc. (as it was my case), and then it is necessary to create some dummy content as a workaround.

必须包含内容的包的规范中存在错误(如评论中的 Evgeni Nabokov 的情况),然后您必须更正规范以将内容落实到位.

There's a mistake in the specification of a package that must have content (as was the case of Evgeni Nabokov in the comments), and then you have to correct the specification to put things in place.

抱歉我的英语不好.

这篇关于Nugets 安装在 Visual Studio 2015 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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