问题描述
有没有办法使用CLI在MS Visual Studio 2010中发布Web项目?我使用DevEnv.exe / Build来构建一个项目,它工作正常,但我找不到选项发布项目。
Is there a way to publish a web project in MS Visual Studio 2010 using CLI? I use DevEnv.exe /Build to build a project and it works fine, but I could not find option to Publish a project.
另一件我想提的。我试图发布web项目不直接到IIS。我有一个位置,我发布多个项目,然后将其自动构建到NSIS bundle中进行部署。
One other thing I want to mention. I am trying to publish web project NOT to the IIS directly. I have a location where I publish several projects and then build them automatically into NSIS bundle to be deployed.
推荐答案
最有效的方法是在项目文件中添加以下目标:
What works best is to add following target to the project file:
<Target Name="AfterBuild">
<Message Text="Copying to Deployment Dir:" />
<Copy SourceFiles="@(Content)" DestinationFolder="..\XXX\%(Content.RelativeDir)" />
<CreateItem Include="$(OutputPath)\*">
<Output TaskParameter="Include" ItemName="Binaries"/>
</CreateItem>
<Copy SourceFiles="@(Binaries)" DestinationFolder="..\XXX\bin" />
</Target>
这样,无论项目何时生成(从命令行或从IDE),它都会自动部署到指定夹。谢谢大家指点我的方向。
This way, whenever project got build (from command line or from IDE) it automatically get deployed to specified folder. Thank you everybody for pointing me to right direction.
这篇关于视觉工作室。从命令行发布项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!