Saturday, March 7, 2015

NuGet Automatic Package Restore

NuGet has been around for quite a few years now, so with changes constantly happening, it is hard to keep up.

I was recently having loads of trouble with resolving NuGet Package references that were updated in a solution and kept on failing to resolve properly when I was performing builds.

I thought that I must be doing something wrong to cause all of this trouble, so I decided to do a bit more investigating as to what might be causing this issue.

As it turns out, NuGet now offers an "Automatic Package Restore" option that supersedes its prior method of NuGet Package Restore using MSBuild:

The "Automatic Package Restore" method is actually the preferred method of restoring NuGet packages now and is stated to be much more reliable.

However, in order to migrate from the old way to the new way, a bit of manual effort is required:

The setting to manage NuGet Automatic Package Restore should automatically be turned on in Visual Studio 2013, so it is unlikely that you will have to turn it on manually.  In the event, that you do actually have to change this setting, it can be found under Tools-->Options-->NuGet Package Manager

This new approach should avoid all of the issues with enabling NuGet Package Restore on each every solution manually and then resolving any project reference failures that typically occur during a build.

No comments:

Post a Comment