Website Building » Wix » Where Are WiX Variables Defined?

Where Are WiX Variables Defined?

Last updated on September 30, 2022 @ 10:48 am

WiX variables are defined in a file called Product.wxs. This file is located in the same directory as your project file.

The Product.wxs file contains the following XML:

GREAT NEWS:

Exciting update! We've collaborated with Wix to offer WBI users with a free plan for all website creation needs - Explore the details here.

<?xml version=”1.0″ encoding=”UTF-8″?>

<Wix xmlns=”http://schemas.microsoft.com/wix/2006/wi”>

<Product Id=”*” Name=”YourProductName” Language=”1033″ Version=”1.0.0″ Manufacturer=”YourManufacturerName” UpgradeCode=”PUT-GUID-HERE”>

<Package InstallerVersion=”200″ Compressed=”yes” />

<Media Id=”1″ Cabinet=”yourproductname.cab” EmbedCab=”yes” />

<Directory Id=”TARGETDIR” Name=”SourceDir”>

<Directory Id=”ProgramFilesFolder”>

<Directory Id=”INSTALLLOCATION” Name=”YourProductName” />

</Directory>

</Directory>

<Feature Id=”ProductFeature” Title=”YourProductName” Level=”1″>

  • <ComponentGroupRef Id=’ProductComponents’/ >
  • & lt ; / Feature & gt ; & lt ; ! — More Product Elements here — & gt ; & lt ; / Wix & gt ;

< p > As you can see, the Product.wxs file contains XML that defines the product features, components, directories, and media. The WiX variable is defined in the < b > Feature < / b > element with the < b > Level < / b > attribute. The value of this attribute is used to determine which WiX feature to use when building your project.

In this example, the value is “1”. This means that the WiX feature “YourProductName” will be used when building your project.

< p >< b > So, where are WiX variables defined? They are defined in a file called Product.wxs, which is located in the same directory as your project file. < / p >

PRO TIP: If you are using WiX to create your installation packages, be aware that the variables you define in your code will be replaced with the values you specify when you compile the code. This can lead to problems if you forget to update the values in your code before compiling, or if you accidentally leave out a variable when compiling.
Kathy McFarland

Kathy McFarland

Devops woman in trade, tech explorer and problem navigator.