Best way to add NuGet packages as project references in VS2012?

Nine Tails picture Nine Tails · Feb 21, 2013 · Viewed 74.4k times · Source

Ok. Really quick question, I'm probably just being thick.

If you right-click on a projects 'references' folder then 'Manage NuGet Packages' you can then install packages and they are automatically referenced by the project you clicked on. But then I want to add the same reference to other projects in the same solution. If you repeat previous but click on another project the only option is to uninstall the package (since it's already installed), what is the proper way to add an existing (already installed) NuGet package as a project reference? Am I to add the reference using the normal dialog and 'browse' to the dll in the packages folder? Use one method to add the first reference then another for subsequent references? That doesn't seem right.

Answer

Pavel Bakshy picture Pavel Bakshy · Feb 21, 2013

You can use Manage NuGet packages for Solution... by:

  • right-clicking on solution
  • Tools > Library Package Manager > Manage NuGet packages for Solution

Then you can choose in which projects install package as on screenshot below: enter image description here Additionally you can add installed package to another projects in solution using the same Manage NuGet packages for Solution.... enter image description here