问题描述
我目前正在研究最初包含一个项目(My.First.Project.Name
)的解决方案.我通过执行以下步骤安装了温莎城堡:
I'm currently working on a solution that initially contained one project (My.First.Project.Name
). I've installed Castle Windsor by executing:
Install-Package Castle.Windsor
我刚刚在解决方案中添加了另一个项目(My.Second.Project.Name
),并希望将Castle Windsor也安装到该项目中,但是当我再次运行Install-Package Castle.Windsor
时,出现错误:
I've just added another project (My.Second.Project.Name
) to the solution and want to install Castle Windsor into this project also, but when I run Install-Package Castle.Windsor
again, I get the error:
所以我的问题是:我如何说服NuGet软件包管理器将软件包安装到第二个项目中??
推荐答案
有3种方法:).
在NuGet 1.1(最新版本)中,我们改进了Powershell流水线,因此您可以执行以下操作:
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
这将在您的所有项目中安装"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
这将使用通配符语义(在这种情况下,请找到所有以mvc开头的项目).
That will use wildcard semantics (in this case, find all projects that start with mvc).
Get-Project SomeProject | Install-Package SomePackage
这会将SomePackage安装到SomeProject中,而不会执行其他任何操作.
That will install SomePackage into SomeProject and nothing else.
这篇关于如何在解决方案的第二个项目中安装NuGet软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!