Compile-time variables

WiX lets you specify variables that are evaluated at compile time. You might use this to get environmental variables from the build machine, get the directory where your source files are, or access custom variables you've set up in a separate WiX include file (.wxi).

WiX has three classifications for preprocessor variables: Environment, System, and Custom. We'll discuss each in the following sections.

Environment variables

Environment variables are set in the environment where the build process is running, usually from the command prompt. The following command sets an environment variable called myVar to the value myvalue:

set myVar=myvalue

To pass this to your project, build your .wxs files from the same command window using ...

Get WiX: A Developer's Guide to Windows Installer XML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.