有没有办法在单个构建上使用msbuild创建多个部署? [英] Is there a way to create more than one deployment with msbuild on a single build?

查看:197
本文介绍了有没有办法在单个构建上使用msbuild创建多个部署?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用msbuild命令行多次为我的dev / test / production网站创建一个部署zip文件。我已经为每个配置参数和配置xml。我想知道我是否可以将我的3个呼叫压缩到一个msbuild,并且立即将它全部构建三个?

I am using msbuild command line multiple times to create a deployment zip file for my dev / test / production websites. I have already configured the parameters and configuration xml for each one. I want to know if i can condense my 3 calls to msbuild down to one, and have it build all three at once?

现在我必须运行

msbuild.exe myproject.sln /T:Build /p:DeployOnBuild=True /p:PublishProfile="Dev Server"
msbuild.exe myproject.sln /T:Build /p:DeployOnBuild=True /p:PublishProfile="Prod Server"

我正在使用的连续部署解决方案(竹子)因为某种原因而忙于多次调用msbuild(我有一张公开的机票,他们也很困惑)。我正在努力简化事情。

The continuous deployment solution i'm using (bamboo) is struggling with this multiple call to msbuild for some reason (i have an open ticket and they are perplexed as well). I'm trying to simplify things.

推荐答案

我有一个模板来并行构建同一个解决方案的所有skus。

I have a template for building out all skus of the same solution in parallel.

与Stijn的方法相同的概念是使用ItemGroup作为项目定义,而不是特定属性的一系列选项+ msbuild任务将在同时,在并行构建时节省时间和冒泡任何配置问题。

This is the same concept as Stijn's approach that uses an ItemGroup as a project definition rather than a series of options for a particular property + the msbuild task will build both at the same time, saving you time and bubbling up any configuration issues when building in parallel.

<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <SolutionToBuild Include="$(MSBuildThisFileDirectory)\MyProject.sln">
        <Properties>DeployOnBuild=True;PublishProfile="Dev Server"</Properties>
    </SolutionToBuild>
    <SolutionToBuild Include="$(MSBuildThisFileDirectory)\MyProject.sln">
        <Properties>DeployOnBuild=True;PublishProfile="Prod Server"</Properties>
    </SolutionToBuild>
  </ItemGroup>
  <Target Name="Build">
    <MsBuild BuildInParallel="true" ContinueOnError="true" Projects="@(SolutionToBuild)" />
  </Target>
  <Target Name="Clean">
    <MsBuild BuildInParallel="true" ContinueOnError="true" Projects="@(SolutionToBuild)" Targets="Clean" />
  </Target>
</Project>

这篇关于有没有办法在单个构建上使用msbuild创建多个部署?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆