Wix Installer - how can I show the value of [Manufacturer] in the install path?

serialhobbyist picture serialhobbyist · Jun 5, 2013 · Viewed 8.1k times · Source

I'm trying to create an installer with a UI, using WiX.

My INSTALLFOLDER is set up using this:

<Directory Id="TARGETDIR"
           Name="SourceDir">
  <Directory Id="ProgramFiles64Folder">
    <Directory Id="ManufacturerFolder"
               Name="[Manufacturer]">
      <Directory Id="INSTALLFOLDER"
                 Name="[ProductName]" />
    </Directory>
  </Directory>
</Directory>

In the <Product> section, I'm defining:

<UIRef Id="WixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />

<Property Id="WIXUI_INSTALLDIR"
          Value="INSTALLFOLDER" />

When I run the installer and get to the Destination Folder panel, I see:

Install Service to: 
C:\Program Files\[Manufacturer]\[ProductName]\

How can I make it evaluate the variables for display?

Note: if I leave them, and click Next, Install and Finish it works. It just looks bad.

Answer

Rob Mensching picture Rob Mensching · Jun 23, 2013

Binder variables can make this very easy without needing to mess around defining preprocessor variables. It'd go a lot like this:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFiles64Folder">
    <Directory Id="ManufacturerFolder" Name="!(bind.property.Manufacturer)">
      <Directory Id="INSTALLFOLDER" Name="!(bind.property.ProductName)" />
    </Directory>
  </Directory>
</Directory>

The !(bind.) syntax is documented in the Linker (light) topic in WiX.chm.