C# – Nugets install in visual studio 2015

cnetnugetvisual-studio-2013visual-studio-2015

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

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.

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

How can I install this nuget in Visual Studio 2015?

Best Answer

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

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.

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

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

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

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

Related Topic