Friday, March 6, 2015

Fixing broken NuGet Package References

I was recently working on a project that heavily used an offshore development team.  As part of updating the projects and the solutions, the team had decided to update various NuGet Package References throughout the solution.

Unfortunately, when I retrieved latest from Team Foundation Server, I could not build the solution at all!  Even when I re-built the solution, Visual Studio was not attempting to restore the package references in my solution!

The only option I had was to try and restore my NuGet Packages from the IDE was "Manage NuGet Packages for Solution"

Of course, clicking on Manage for my individual NuGet Package references did not offer me any options to restore my NuGet Packages either!

I tried to click on Updates and update my NuGet Package references, but clicking on the Update button had no effect at all.

Therefore, I decided to revert to the handy dandy NuGet Package Manager Console and attempt to run the following command to restore my missing package references:

Update-Package -reinstall <Package Name>

One of the updated NuGet Package References was EntityFramework so I ran the following command:

Update-Package -reinstall EntityFramework

Running this command for all of my various missing project references resolved my issue and I was able to check-in the updated packages.config and .csproj files into Team Foundation Server again.

As a final verification, I checked the autobuild server and lo and behold everything built successfully!!  Woo hoo!

No comments:

Post a Comment