Search code examples
c++wixplatform

How to change $(var.Platform) from x86 to Win32 in Wix


I have a Visual C++ 2013 solution including many C++ projects and a WIX installer project. On x64 platform, everything is okay. But On x86 platform, $(OutDirectory)$(Platform)$(Configuration) of C++ projects is ...Win32..., but $(OutDirectory)$(Platform)$(Configuration) of WIX is ...x86... What can I do?


Solution

  • You should have all the projects added to your WiX project as references. Lets say one of your C++ projects was called "MyHelperProject." You can access that projects output binary like this:

    <Component Guid="{723E4174-C9D2-4385-844E-C7D035B0C8FB}" Directory="INSTALL_ROOT">
        <File Source="$(var.MyHelperProject.TargetPath)" KeyPath="yes"/>   
    </Component>
    

    Or, if you want to grab other files from that build:

    <Component Guid="{A0D64469-A90C-4DF3-A54B-B386AC49E6E7}" Directory="INSTALL_ROOT">
        <File Source="$(var.MyHelperProject.TargetDir)required_file.txt" KeyPath="yes"/>
    </Component>