Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

wix

wix3.7

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.

like image 729
serialhobbyist Avatar asked Jun 05 '13 17:06

serialhobbyist


People also ask

Is WiX Installer free?

Download. You can download the WiX toolset for free.


2 Answers

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.

like image 63
Rob Mensching Avatar answered Sep 21 '22 12:09

Rob Mensching


Define your variables in a config file.

For example, create a file named config.wxi containing the following:

<?xml version="1.0" encoding="utf-8"?>
  <Include>
    <?define Manufacturer = "Company Name" ?>
    <?define ProductName = "Product Name" ?>
  </Include>

Then reference the variables in your .wxs file using $(var.Manufacturer) and $(var.ProductName).

like image 42
BryanJ Avatar answered Sep 23 '22 12:09

BryanJ