WiX (Windows Installer Xml), Create universal variables

I haven’t used these constructs that much. However, I think Bob Arnson (WiX developer) explains this pretty well in this blog entry about localization (the explanation is good, but I still manage to confuse myself – carbon error).

Essentially:

  • Preprocessor variables$(var.Variable) – are resolved by the WiX preprosessor – it happens before compilation (Candle.exe).
  • Localization variables!(loc.LanguageLcid) – are resolved at link time (Light.exe). The linking process can spit out multiple MSI files in different languages. Hence localization is a link-time process.
  • See link 3 below for a localization sample. Once you localize, you localize most or all fields. In the sample below I don’t localize version and upgrade code – they remain the same for all output MSI files.
  • You have to determine in each case what should be localized. Should the Manufacturer name be localized? Perhaps if you want Asian characters for Asian setups, and an equivalent Latin character name otherwise?
  • Include files are simply included in the WiX source before compilation. It is like including a header file in C++. This makes it a preprocessor construct. See link 2 below for a discussion of the use of include files.
  • UPDATE: There are also Burn Engine Variables – if you make setup.exe launchers with WiX.
  • WixVariable:

I am sure there are other technical reasons as well. Rob or Bob would need to illuminate. There could also be differences in WiX 4 than what I am used to in WiX 3 – and there could be changes planned that I am unaware of.


Some Links:

  1. Is it possible to pass variable to WIX localization file? (for easy retrieval)
  2. Wix Installer : Setting component condition property when doing a MSIEXEC admin install at command line (a lenghty description of preprocessor constructs versus other useful constructs to create flavors of setups)
  3. Wix toolset license agreement multi-languages issue (using localization)
  4. Wix string with characters not available in database ‘s codepage although codepage is set
  5. On various preprocessor constructs $(env.someval), $(sys.someval), $(var.someval): https://wixtoolset.org/documentation/manual/v3/overview/preprocessor.html

Leave a Comment