Reference Not Available - Does Not clean up the package.config - NuGet still believes you have the package installed

Mar 25, 2011 at 3:10 PM
Anyone else see this? Something to the effect of the below:

Reference Not Available
package version installed successfully.

I tried adding a reference to a Silverlight Project that is not for SL and watch it try to add it and then unreference it as it is not available for that project type.

But it doesn't clean up the packages.config. So NuGet believes that it is installed.

I have included a link to a download at the bottom so you can verify this behavior.

Steps to repro:
1. Create a silverlight project
2. Add a reference to automapper to it.


automapper has this structure

automapper
--/lib
----/automapper.dll


So the reference is not there, but I still have the package installed in that silverlight project. As an end user if the package install is not successful, I should not have it installed.

This seems like a bug to me. Didn't see any other notes in discussions, so I thought I would open this discussion.


Running on Win7 x64 SP1 - VS2010 Ultimate - NuGet 1.1.229.160

Developer
Mar 25, 2011 at 3:29 PM

It's a bug in VS. You're adding the .net version automapper to a silverlight project. Try manually adding the reference, the same thing happens.

Mar 25, 2011 at 3:33 PM
The bug to me is the discrepancy of having a package successfully installed versus not.

As an end user, if the install doesn't go correctly (I now have a reference in this case), then NuGet should not be reporting that it is.

The bug to me is that NuGet thinks the package is valid. As an end user I see that this package did not successfully install, but in NuGet it believes all is good and I can even call update and it will.


Mar 25, 2011 at 3:38 PM
Does this make sense? I know and you know that the automapper package only contains a .net only version, but that doesn't mean everyone else will.

This was actually discovered by a junior member of my team this morning. I hadn't thought about it, and everything looks good from the perspective of the user until they try to figure out why they don't have the package they thought they did. NuGet from the GUI never tells them otherwise, and when they look at it, it tells them it is installed, and can be updated, but the reference they expect is not there.

It can be frustrating for someone because everything looks hunky-dory and it's not. But there is no key to the end user other than the reference just is not happening.
Developer
Mar 25, 2011 at 3:39 PM

The reason we mark packages as "installed" even though something might have failed part of the way through is so that you can call Uninstall-Package and still remove it. BTW in NuGet 1.2 that warning will show up as an error saying failed to add reference.

Mar 25, 2011 at 3:41 PM
Right on. :D

I didn't see any discussions or work items when I searched for Reference Not Available. I should have broadened my search... lol

Developer
Mar 25, 2011 at 3:49 PM

I think this came up before with Moq, but I can't find the discussion/issue with it.