Skip to content

Latest commit

 

History

History

firegiant-examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Firegiant's WiX examples

Firegiant Company 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.

  1. Getting Started
  2. User Interface
  3. Events and Actions
  4. Upgrades and Modularizations
  5. User Interface Revisited

SampleFirst Example

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 file target\src_gen\SampleFirst.wxs contains the real GUIDs instead of the symbol names defined in file src\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).

SampleCondition

WIP

SampleWixUI

WIP

SampleWixUIAddDlg

WIP

SampleWixUIAddDlgLoc Example

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 Example

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' becomes Id='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' becomes Source='!(bindpath.app)\FoobarAppl10.exe'). The real file location is resolved at build time using the -b "<var>=<path>" option of the WiX linker light.
  • 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.
The build steps to generate a Windows installer are:
Preprocessing with build.bat
target\src_gen\SampleFirst.wxs
Compilation with %WIX%\candle.exe
target\SampleFirst.wixObj
Linking with %WIX%\light.exe
target\SampleFirst.msi
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 file src\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).

[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.

mics/December 2023