Reputation: 106530
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)
Upvotes: 1
Views: 760
Reputation: 106530
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>
Upvotes: 5