How do I install a NuGet package into the second project in a solution?

In Visual Studio 2015 (as of Nuget v3.1.2) the syntax is now:

Install-Package ThePackage -ProjectName YourProjectName

Note: -ProjectName vs -Project


There's 3 approaches :).
In NuGet 1.1 (The latest release) we've improved powershell pipelining so you can do this:

Get-Project -All | Install-Package SomePackage

That will install "SomePackage" into all of your projects. You can use wildcards to narrow down which projects:

Get-Project Mvc* | Install-Package SomePackage

That will use wildcard semantics (in this case, find all projects that start with mvc).

Get-Project SomeProject | Install-Package SomePackage

That will install SomePackage into SomeProject and nothing else.


The answer is, embarassingly, blindlingly simple.

The "Package Manager Console" has a drop-down titled "Default Project" in its toolbar, changing the project there to My.Second.Project.Name then allows Install-Package Castle.Windsor to install the package into the second project.


There's two approaches.

As you already learned, the Package Manager Console has a drop down that lists the projects in your solution.

The other approach is to use the -Project flag. Nice thing about that is it gives you Intellisense with the project names! For example:

Install-Package SomePackage -Project MvcApplication2