Missing NuGet Packages and Visual Studio | Derik Whittaker
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.
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.
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)
I decided that I would simply do install the BCL package I wanted and the world would be happy… NOPE
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,