Pages - Menu

Restore NuGet Packages the Right Way

The Infamous Right Click to Enable NuGet Package Restore

Recently engaged in a conversation about NuGet and one of the developers suggested to me "Did you right click the solution to enable NuGet restore?" I was a little shock and unease as this is a very very old and obsoleted way of using NuGet and is not relevant in today's code of practice.

Let's learn the right way together!

NuGet Team documented 3 ways to restore packages.
  1. Automatic Package Restore in Visual Studio
  2. Command-Line Package Restore
  3. MSBuild-Integrated Package Restore
As the NuGet Team explained.
"Prior to NuGet 2.7, an MSBuild-Integrated Package Restore approach was used and promoted. While this approach is still available, the NuGet team suggests using the Automatic Package Restore and Command-Line Package Restore instead."
Or what other people twitted.
"Every Time someone enables #nuget package restore on a solution, a kitten dies. Learn the new workflow!"


What is the best practice? Automatic Package Restore is the number one recommended method. You may however find yourself using CLI Packge Restore if you are building a CI server which is not so bad. The worst possible scenario is you are still doing "Right Click to Enable NuGet Package Restore". Say hello to 2015 :)

No comments:

Post a comment