Updating a NuGet package fails saying it’s not installed

If you try to update a NuGet package, and get an error saying:

Update-Package : 'package' was not installed in any project. Update failed.

(but it’s definitely already in use), it may be because of this.

In my case, I’d got into the situation by previously updating the package, and then reverting the changes. Because we’re using the package restore functionality, this meant the package repo contained a newer version of the package than the packages.config referenced. Which didn’t go down well!

The solution is to delete the offending newer package (or just nuke the whole contents of the packages folder (except the repositories.config!), and re-build). You’ll need to close VS first, as it locks the files.

Hopefully a future version of NuGet will provide a more informative message :)

Advertisements

4 thoughts on “Updating a NuGet package fails saying it’s not installed

      • Richard March 21, 2012 / 4:39 pm

        I heard there were problems with the versioning on the Log4net nuget package. Apparently they changed the assembly’s strong name without changing the version number or something.

      • Graham Hay March 21, 2012 / 6:57 pm

        Ah, yes. I think they ended up bumping the version to 2.0. This is purely self-inflicted (sort of).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s