.net – NuGet for solutions with multiple projects

netnuget

Suppose I have a solution with 3 projects:

  • Core
  • UI
  • Tests

Some of the NuGet packages I use will apply to all 3 projects. Some will just apply to UI and Tests, and some will just apply to Tests (like NUnit).

What is the right way to set this up using NuGet?

  1. Should I use "Add Library Package Reference" on all three projects any time I need a reference?
  2. Should I use "Add Library Package Reference" the first time I need a package, and then use Add Reference->Browse for subsequent usages?

In either case, how many packages.config files should I have?

Best Answer

For anybody stumbling across this, now there is the following option :

Right-click your solution > Manage NuGet Packages for Solution...

... Or:

Tools > Library Package Manager > Manage NuGet Packages for Solution...

And if you go to the Installed packages area you can 'Manage' a single package across every project in the solution.