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

查看:125
本文介绍了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.

EDIT 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.

对不起,我的英语不好。

Sorry for my bad english.

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

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