简体   繁体   English

TFS MSBuild:在单个 TFS.proj 文件中结合并行构建和顺序构建

[英]TFS MSBuild: Combining parallel builds and sequential builds in a single TFS .proj file

I'll lay down the scenario:我会列出这个场景:

  1. We have a TFS build.proj that builds 3 dependency solutions sequentially.我们有一个 TFS build.proj 依次构建 3 个依赖解决方案。
  2. It then builds about 100 unrelated solutions in parallel.然后它会并行构建大约 100 个不相关的解决方案。

This seemed to work fine under .net 3.5, however since we've moved to 4.0 it appears that the dependency solutions are build in parallel which is causing issues.这似乎在 .net 3.5 下运行良好,但是由于我们已经移至 4.0,因此依赖解决方案似乎是并行构建的,这导致了问题。

I could always just do an我总是可以做一个

<Exec Command="C:\PATH\TO\MSBUILD SOLUTION1">
<Exec Command="C:\PATH\TO\MSBUILD SOLUTION2">
<Exec Command="C:\PATH\TO\MSBUILD SOLUTION3">

etc but this seems a bit messy.等等,但这似乎有点乱。

So my question: How do I tell MSBUILD to build some solutions in sequence and THEN build loads of others in parallel?所以我的问题是:我如何告诉 MSBUILD 按顺序构建一些解决方案,然后并行构建其他负载?

(Our current build pattern is below) (我们当前的构建模式如下)

<ItemGroup>
  <SolutionToBuild0 Include="$(SolutionRoot)\Solutions\MSBuildTasks\MSbuildTasks.sln"/>

  <SolutionToBuild1 Include="$(SolutionRoot)\Solutions\Level1\Level1.sln" />

  <SolutionToBuild2 Include="$(SolutionRoot)\Solutions\Level2\Level2.sln" />

  <SolutionToBuild3 Include="$(SolutionRoot)\Solutions\xxx.Reporting\xxx.Reporting.sln />
</ItemGroup>

<MSBuild Projects="@(SolutionToBuild0)" Targets="Build" Properties="TeamBuildConstants=$(TeamBuildConstants)" BuildInParallel="false" />

<MSBuild Projects="@(SolutionToBuild1)" Targets="Build" Properties="TeamBuildConstants=$(TeamBuildConstants)" BuildInParallel="false" />
<MSBuild Projects="@(SolutionToBuild2)" Targets="Build" Properties="TeamBuildConstants=$(TeamBuildConstants)" BuildInParallel="false" />
<MSBuild Projects="@(SolutionToBuild3)" Targets="Build" Properties="TeamBuildConstants=$(TeamBuildConstants)" BuildInParallel="false" />

<SolutionToBuild Include="$(SolutionRoot)\Solutions\xxx.LocationImporter\xxx.LocationImporter.sln" />
<SolutionToBuild Include="$(SolutionRoot)\xxx\Dev\Source\server_and_common2008.sln" />

` `

You mentioned solution dependency, I'm wondering if you can use project reference to solve your problem?您提到了解决方案依赖性,我想知道您是否可以使用项目参考来解决您的问题? If you can specify the dependency of your projects using project references then MSBuild will figure out what it needs to build in parallel and what not.如果您可以使用项目引用指定项目的依赖关系,那么 MSBuild 将确定并行构建需要什么,不需要什么。

See if your problem can be solved by the anwers in the Team Build forum:查看 Team Build 论坛中的回答是否可以解决您的问题:

http://social.msdn.microsoft.com/Forums/en/tfsbuild/thread/80b15488-771e-4b0f-92a3-0175a639286e http://social.msdn.microsoft.com/Forums/en/tfsbuild/thread/80b15488-771e-4b0f-92a3-0175a639286e

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM