To create an installer, WiX uses xml for the declaration. When you use Votive, it creates an initial xml named product.wxs for you. In this tutorial we’ll cover all elements in it.
The product.wxs file
The following diagram shows the structure of a WiX setup. It should give you a better idea, where an xml-element belongs to, when you read the detaildescription of them below.
The wix-element contains all other elements. You do not need to change anything on it.
The product-element specifies the productname, version, manufacturer and upgrade code. Your upgradecode must never change, except if you want to release a new major-version. Windows determines wit this code, if a version of your product is already installed. The manufacturer is empty after creation and must be set, otherwise an error will be thrown on build.
<Wix ...> <Product Id="*" Name="MyWpfApplicationSetup" Language="1033" Version="184.108.40.206" Manufacturer="" UpgradeCode="3fe81ed2-a656-4c85-9df2-654c3318d720"> </Wix>
The package specifies how the installation should run. The default says, the Windows-Installer version 2.0 is required, the sourcefiles shall be compress and the installation is per machine. If your installer requires elevated rights, you could set the attribute InstallPrivileges to ‘elevated’.
<Wix ...> <Product ...> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> </Product> </Wix>
Allows you to define settings for the mediatype you’ll deploy your settings on. If our setup is small, we can add the attribute EmbedCab to it and set its value to ‘yes’. With this set, everything will be in one msi-file.
<Wix ...> <Product ...> <MediaTemplate /> </Product> </Wix>
A product can have one or more features. Depending on the users needs, she can choose to install all of them or only those she needs. Features can be installed separatly from the commandline as well:
msiexec /i MyWpfApplicationSetup.msi ADDLOCAL=MyWpfApplicationSetup
<Wix ...> <Product ...> <Feature Id="ProductFeature" Title="MyWpfApplicationSetup" Level="1"> </Product> </Wix>
A feature is made of one ore more components. These components are grouped in componentgroups. To illustrate this better, lets zoom a little bit more into the diagram from the beginning of this page.
This organization seems a littlebit complicated at first, but this structure allows to manage very large projects as well.
A componentgroupref is nothing else than a reference/link to a componentgroup. Having the reference there instead of the group itself keeps the setup better maintainable.
<ComponentGroupRef Id="ProductComponents" />
Create your first setup in the next two tutorials!