3

Is it possible to be able to build all projects of a solution with x86 and "any cpu" projects in it from MSBuild?

Ideally I would like a solution that would work regardless of whether the project has multiple platforms or not because it's often not obvious when you add a project that defaults to x86 and you have to spend a lot of time figuring out why your project isn't being built.

Helephant
  • 16,738
  • 8
  • 39
  • 36
  • do you want to build everything as "Any CPU" or everything as "x86"? – Filip De Vos Feb 28 '12 at 14:21
  • I'd like to build the "Any CPU" solutions as "Any CPU" and the x86 solutions as x86. It would be nice if it acted the same as when the projects are built in VS. – Helephant Feb 28 '12 at 14:25
  • The biggest issue is that you need to know that MSBuild has this quirkiness or you'll waste lots of time figuring out why the project isn't building. – Helephant Feb 28 '12 at 14:26

2 Answers2

2

Try to use solution-level platform called "Mixed Platforms". See this post.

  msbuild.exe MixedProjects.sln /p:"Platform=Mixed Platforms" /p:Configuration=Debug
Ludwo
  • 6,043
  • 4
  • 32
  • 48
0

If your solution has multiple platforms you want to target, it's possible to define multiple configurations to build in your tfsbuild.proj file:

<ItemGroup>
  <ConfigurationToBuild Include="$(BuildFlavour)|Any CPU">
    <FlavorToBuild>$(BuildFlavour)</FlavorToBuild>
    <PlatformToBuild>Any CPU</PlatformToBuild>
  </ConfigurationToBuild>
  <ConfigurationToBuild Include="$(BuildFlavour)|x86">
    <FlavorToBuild>$(BuildFlavour)</FlavorToBuild>
    <PlatformToBuild>x86</PlatformToBuild>
  </ConfigurationToBuild>
</ItemGroup>

MSBuild and TFSBuild will build any projects that match either configurations.

Helephant
  • 16,738
  • 8
  • 39
  • 36