Firegiant's WiX examples ⬆
Directory firegiant-examples\ contains the WiX Toolset examples presented in the Firegiant's online WiX Toolset Tutorial, the authoritative guide for WiX developers.
|
The WiX examples presented in the following sections are adapted1 from the onlie WiX Toolset Tutorial and are organized in the same way as our WiX examples from page myexamples/README.md
.
- Getting Started
- User Interface
- Events and Actions
- Upgrades and Modularizations
- User Interface Revisited
In this first example the WiX source file SampleFirst.wxs
declares 4 component
elements for the 3 application files and one menu shortcut.
The project is organized as follows :
> cd Y:\firegiant-examples\SampleFirst > tree /f . | findstr /v /b [a-z] │ build.bat ├───app │ FoobarAppl10.exe │ Helper.dll │ Manual.pdf └───src SampleFirst.wxs
🔎 Command
build help
displays the batch file options and subcommands.
Command build pack
generates the MSI package file:
> build clean pack && tree /f target | findstr /v /b [a-z] │ candle_ops.txt │ candle_sources.txt │ light_opts.txt │ Sample.cab │ SampleFirst.msi │ SampleFirst.wixobj │ SampleFirst.wixpdb └───src_gen SampleFirst.wxs
🔎 In the above listing of the
target\
directory filetarget\src_gen\SampleFirst.wxs
contains the real GUIDs instead of the symbol names defined in filesrc\SampleFirst.wxs
.
Figures 1.1 to 1.3 below illustrate the updated user environment after the successful execution of the SampleFirst Windows installer.
Figure 1.1 - Foobar executable (Program Files (x86) folder). |
Figure 1.2 - Foobar shortcuts (Start Menu folder). |
Figure 1.3 - Uninstalling Foobar (Settings window). |
WIP
WIP
WIP
WIP
SampleRegistry
Example ▴
SampleRegistry
is organized in the same way as the previous examples.
Again command build pack
generates the Windows installer:
> build clean pack && tree /f target | findstr /v /b [a-z] │ candle_ops.txt │ candle_sources.txt │ light_opts.txt │ Sample.cab │ SampleRegistry.msi │ SampleRegistry.wixobj │ SampleRegistry.wixpdb └───src_gen SampleRegistry.wxs
SampleLocalization
implements the user interface of the Windows installer.
WIP
Footnotes ▴
[1] Archive contents ↩
-
The contents of each archive file is minimal; for instance the
SampleFirst.zip
example contains one WiX source file and 3 dummy (and invalid) binary files: -
> unzip -Z1 SampleFirst.zip Helper.dll FoobarAppl10.exe Manual.pdf SampleFirst.wxs
- Concretely, we undertake the following modifications of the original examples:
-
-
We modify the original
SampleFirst.wxs
file as follows:- We replace the
YOURGUID-<...>
placeholders by unique symbolic names (e.g.Id='YOURGUID-86C7-4D14-AEC0-86416A69ABDE'
becomesId='YOURGUID-PRODUCT_ID'
) in order to delay and automatize their substitution (more details below). - We introduce bindpath variables to specify the file location in the
Source
tags (e.g.Source='FoobarAppl10.exe'
becomesSource='!(bindpath.app)\FoobarAppl10.exe'
). The real file location is resolved at build time using the-b "<var>=<path>"
option of the WiX linkerlight
.
- We replace the
-
We replace
Manual.pdf
by a valid dummy PDF file available from the W3C. In this way the user can successfully open the PDF file (e.g. from the program menu "SampleFirst") after the installation is done.
-
We modify the original
- The build steps to generate a Windows installer are:
- The preprocessing step consists of several operations:
-
- We generate a GUID 2 with the PS cmdlet
New-Guid
. - We associate a new GUID to each symbolic name (e.g.
'YOURGUID-PRODUCT_ID'
) found in filesrc\SampleFirst.wxs
. - We save the association into the file `build.properties` to ensure the same GUID is reused when generating the MSI package again build.bat takes existing GUIDs from
build.properties
instead of generating new ones).
- We generate a GUID 2 with the PS cmdlet
target\src_gen\SampleFirst.wxs
target\SampleFirst.wixObj
target\SampleFirst.msi
[2] GUID ↩
- A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.