1

I have a program which must build as 32 bit. It gets shipped with an x64 application. As a result, there is an installer which gets a bitness.

The installer is built with a wixproj that must be built with /p:Platform=x64 -- but the vcxproj needs to build as x86.

I tried forcing Platform to be x86 or Win32 by setting it explicitly:

<PropertyGroup>
  <Platform>Win32</Platform>
</PropertyGroup>

but it appears that the command line switch that got passed to the wixproj "wins" when building.

Is there some way that the project file can force Platform to be Win32 no matter what is specified on the command line?

(for csproj I was able to do this:

<PropertyGroup>
  <PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>

but that doesn't have any effect on C++ it seems)

Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
  • since youre asking this I assume you are not building them seperately - how are you building those project then? Are they part of a single solution? You use a master build file? Can you maybe show the msbuild part that invoked building each of them? – stijn Jan 21 '14 at 07:28
  • @stijn: `msbuild foo.wixproj /p:Platform=x64 /p:Configuration=Release` – Billy ONeal Jan 21 '14 at 17:19

1 Answers1

4

Finally figured this out. MSBuild has a setting TreatAsLocalProperty that allows a project file to override any variable, which goes into the Project node at the beginning of the file.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" 
         ToolsVersion="4.0"
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
         TreatAsLocalProperty="Platform"> <!-- !!! -->
  <PropertyGroup>
     <Platform>Win32</Platform>
  </PropertyGroup>
  <!-- Now Platform is Win32 no matter what! -->
</Project>
Billy ONeal
  • 104,103
  • 58
  • 317
  • 552