Missing NuGet Packages and Visual Studio

Today I was trying to update my solution to use the newest version of some of the NuGet packages, I had a few items a bit out of date. I did the update via the UI in Visual Studio, everything appeared to be working as expected, until I go to build. The build failed w/ the message below.

MissingNuGet

If you look at my packages.config file (below) you will notice I am only referencing 2 packages, MVVM Light and NewtonSoft.Json
MyPackages

What is really odd is I have the NuGet package restore turned on, why am I getting this message? I wanted to ensure that my packages were in fact being downloaded so I went to my packages folder to check… and yup they were in fact downloaded.

PackagesHighlighted

Now I was confused. I did what every good developer would do. I deleted my packages folder then I did a clean in VS, then I did a rebuild… I still received the same message :(

Next I decided I wanted to see what my .csproj file was telling me so I opened this up and did a search for packages. Because clearly the project was looking for something that I did not know about. When I did this I found something that looked fishy. The WRONG version of the Microsoft.BCL.Builds package was being referenced, but it was NOT in my packages.config… WTF. (other projects in my solution were referencing the correct version of the BCL package)

ProjectFile_01

I decided that I would simply do install the BCL package I wanted and the world would be happy… NOPE

Now when I look at my .csproj file I have 2 entries for the BCL.Builds package. The old one AND the new one, but my packages.config was correct… WTF
ProjectFile_02

I decided to do a build anyway just to see what would happen, as you may have guessed it failed.

I finally decided I was going to remove the config manually for the old version.

Once I removed the OLD version in the config my project built just fine.

The moral of the story is this. If you get odd missing packages errors from NuGet manually check your project file to see if it is actually configuration correctly.

Till next time,

This entry was posted in NuGet, Visual Studio. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

Leave a Reply