views:

2013

answers:

4

I have two solutions to build in Teambuild, one is the application itself, the other one is the WiX installer. I want to build the application using "Any CPU" build configuration and the installer using "x86". I've listed the "Any CPU" solution first in my project file, but Teambuild always builds the "x86" solution first.

I'm setting BuildSolutionsInParallel = false, but it still builds the solutions in the reverse listed order. If I change the first solution to "Mixed Platform", it works fine. How can I get the solutions to build in the order listed in the project file?

<Project ...>
<PropertyGroup>
  <!-- We want to build the install solution after the build solution -->
  <BuildSolutionsInParallel>false</BuildSolutionsInParallel>
</PropertyGroup>

<ItemGroup>
  <SolutionToBuild Include="$(BuildProjectFolderPath)/Pricer/Pricer.sln">
    <Targets></Targets>
    <Properties></Properties>
  </SolutionToBuild>
  <SolutionToBuild Include="$(BuildProjectFolderPath)/Pricer/Pricer.Install/Pricer.Install.sln">
    <Targets></Targets>
    <Properties></Properties>
  </SolutionToBuild>
</ItemGroup>

  <ItemGroup>
    <ConfigurationToBuild Include="Release|Any CPU">
      <FlavorToBuild>Release</FlavorToBuild>
      <PlatformToBuild>Any CPU</PlatformToBuild>
    </ConfigurationToBuild>
    <ConfigurationToBuild Include="Release|x86">
      <FlavorToBuild>Release</FlavorToBuild>
      <PlatformToBuild>x86</PlatformToBuild>
    </ConfigurationToBuild>
  </ItemGroup>
</Project>
A: 

Ok, I'm not sure if it's the same with Teambuild but What about setting the build order of the projects via "Project -> Project Build Order"?

seanlinmt
tried that, didn't work :(
Jeroen Landheer
+1  A: 

Project Build Order may be set for projects belonging to the same solution. In this case, for unrelated reasons the projects need to belong to 2 different solutions.

I've discovered here that a C# project in a "Mixed Platforms" solution will build as "Any CPU", so the solution is to always use "Mixed Platforms" in the Teambuild project file.

Art Vandalay
+2  A: 

The issue here is that Any CPU is treated slightly differently, by convention, than other configurations - it is left out of output directory hierarchies, for example. In the Team Build targets file, then, there is a target called ComputeConfigurationList:

<ItemGroup>
  <!-- ConfigurationList for any Platform but Any CPU -->
  <ConfigurationList Condition=" '%(ConfigurationToBuild.PlatformToBuild)' != 'Any CPU' " Include="$(MSBuildProjectFile)">
    <Properties>Configuration=%(ConfigurationToBuild.FlavorToBuild);Platform=%(ConfigurationToBuild.PlatformToBuild);TeamBuildOutDir=$(BinariesRoot)\%(ConfigurationToBuild.PlatformToBuild)\%(ConfigurationToBuild.FlavorToBuild)\;TeamBuildPublishDir=$(BinariesRoot)\%(ConfigurationToBuild.PlatformToBuild)\%(ConfigurationToBuild.FlavorToBuild)\</Properties>
  </ConfigurationList>
  <!-- ConfigurationList for Any CPU Platform -->
  <ConfigurationList Condition=" '%(ConfigurationToBuild.PlatformToBuild)' == 'Any CPU' " Include="$(MSBuildProjectFile)">
    <Properties>Configuration=%(ConfigurationToBuild.FlavorToBuild);Platform=%(ConfigurationToBuild.PlatformToBuild);TeamBuildOutDir=$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)\;TeamBuildPublishDir=$(BinariesRoot)\%(ConfigurationToBuild.FlavorToBuild)\</Properties>
  </ConfigurationList>
</ItemGroup>

This target processes the incoming ConfigurationToBuild item group in two batches - Any CPU and everything else. The resulting ConfigurationList item group is thus sorted differently than the original ConfigurationToBuild item group, with all the Any CPU configurations coming after all the non Any CPU configurations.

The workaround, if the order of your configurations is important, is to define a new solution configuration for all of your solutions - see the blog post referenced above for instructions on this. For example, you could define a configuration called TFS that is based on Any CPU for your Any CPU solutions, on Win32 for those solutions, etc. Then in your TfsBuild.proj file you would only include this one configuration in your ConfigurationToBuild item group. This will have the nice side effect of getting rid of the various "invalid configuration" warnings you are probably getting right now when TFS Build tries to build your Win32 configurations for Any CPU and vice versa.

A: 

I've just posted a simliar question, because it seems like the same issue but without any relation to AnyCPU. Was this ever resolved?

http://stackoverflow.com/questions/2656389/why-does-tfs2010-build-my-wix-project-before-anything-else

bwerks