Unable to find assembly references that are compatible ...

Feb 11, 2011 at 5:33 PM

I am trying to create a very simple package containing a single DLL. Structure:


Get error when trying to install the package:

"Unable to find assembly references that are compatible with the target framework '>NETFramework, Version=v4.0"

The assembly is indeed .NET 4.0 and if I unzip the nupkg and take the assembly out of it and reference it directly, the reference is added.

I am using Nuget.exe version 1.1.2120.136 

Feb 11, 2011 at 5:43 PM

Strange, I think that should just work. dfowler will likely have ideas about what's going on. One thing you can try in the mean time is to take an existing similar package that works and try to find some difference.

Feb 11, 2011 at 5:50 PM

That should work, what version of the nuget client are you using? (type $host.Version from the console) Are things being packaged correctly? You can update to the newest command line tool on the feed and use nuget pack -v to see what gets packaged. Can you verify that the structure inside the zip has the lib folder with the assembly under it?

Feb 11, 2011 at 5:50 PM

Okay, I finally found out what happened.  It appears that I made a mistake the first time I created the package.  So on the first installation I got the error, and I realized what I did (I had a typo in the lib/framework folder).  I corrected the problem and recrated the package.  Then it would always throw the same error.  Then I discover that the old broken version still existed in the project/packages folder.  Meaning that the fixed version was never being installed. So I had to delete the packages folder and then tried it again, and it worked as expected.

I assumed that when it threw the error that the package was not installed.  It also did not show in the installed list in the Add Library Package Reference dialog.  Which reinforced the idea that the package never installed.  But it did and it would not allow the fixed package to overrite it.

Hope that makes sense.

Feb 11, 2011 at 6:24 PM

Yep, it does. We have a bug to not install things at solution level if it fails at project level. The dialg only shows things installed into the project, not solution.

Feb 11, 2011 at 6:27 PM

Tip: next time if you want to see what gets packaged into your .nupkg file, you can use the Package Explorer tool that I wrote (http://nuget.codeplex.com/releases/view/59864). :D