Skip to content

michelou/wix-examples

Repository files navigation

Playing with WiX Toolset on Windows

WiX project This repository gathers Windows installer examples coming from various websites and books.
It also includes several build scripts (batch files) for experimenting with the WiX Toolset on a Windows machine.

Ada, Akka, C++, COBOL, Dart, Deno, Docker, Erlang, Flix, Golang, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, TruffleSqueak and Zig are other topics we are continuously monitoring.

Project dependencies

This project depends on two external software for the Microsoft Windows platform:

Optionally one may also install the following software:

Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we defined C:\opt\ as the installation directory for optional software tools (similar to the /opt/ directory on Unix).

For instance our development environment looks as follows (July 2024) 5:

C:\opt\ConEmu\                 ( 26 MB)
C:\opt\Git\                    (314 MB)
C:\opt\ImageMagick-7.1.0-Q16\  (300 MB)
C:\opt\VSCode\                 (341 MB)
C:\opt\WiX-3.14.1\             (116 MB)
C:\Program Files (x86)\instedit.com\InstEd\  (  7 MB)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\  (2.98 GB)
C:\Program Files (x86)\Windows Kits\10\      (5.46 GB)

🔎 Git for Windows provides a BASH emulation used to run git from the command line (as well as over 250 Unix commands like awk, diff, file, grep, more, mv, rmdir, sed and wc).

Directory structure

This project is organized as follows:

docs\
examples\{README.md, MiniAppKiller, uberAgent}
firegiant-examples\{README.md, SampleFirst, etc.}
myexamples\{README.md, MyApp, etc.}
openjdk-examples\{README.md, OpenJDK11, etc.}
scala2-examples\{README.md, Scala2First, Scala2UI, etc.}
scala3-examples\{README.md, Scala3First, Scala3UI, etc.}
MSI.md
QUICKREF.md
README.md
RESOURCES.md
SECURITY.md
SETUP.md
setenv.bat

where

Batch commands

setenv.bat 6

Command setenv.bat is executed once to setup our development environment; it makes external tools such as code.cmd and git.exe directly available from the command prompt.

> setenv -verbose
Tool versions:
   candle 3.14.1.8722, light 3.14.1.8722,
   msiinfo 5.0, uuidgen v1.01, magick 7.1.0-7,
   git 2.45.2, diff 3.10, diff 3.10
Tool paths:
   C:\opt\WiX-3.14.1\candle.exe
   C:\opt\WiX-3.14.1\light.exe
   C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\MsiInfo.exe
   C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\uuidgen.exe
   C:\opt\ImageMagick-7.1.0-Q16\magick.exe
   C:\opt\Git\bin\git.exe
   C:\opt\Git\usr\bin\diff.exe
   C:\opt\Git\bin\bash.exe
Environment variables:
   "GIT_HOME=C:\opt\Git"
   "JAVA_HOME=C:\opt\jdk-temurin-11.0.23_9"
   "MAGICK_HOME=C:\opt\ImageMagick-7.1.0-Q16"
   "SBT_HOME=C:\opt\sbt"
   "WINSDK_HOME=C:\Program Files (x86)\Windows Kits\10"
   "WIX=C:\opt\WiX-3.14.1"
 
> where msiinfo git
C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x86\MsiInfo.exe
C:\opt\Git\bin\git.exe
C:\opt\Git\mingw64\bin\git.exe

Footnotes

[1] ImageMagick

ImageMagick is a free software to create, edit, compose, or convert digital images. In this project we rely on the convert tool to customize the dialog windows in the generated Windows installer.

[2] InstEd

InstEd is a free MSI editor built for professionals. In this project we use that tool to inspect Windows installers available for other software products, e.g.

[3] Visual Studio 2019

Microsoft Visual Studio 2019 is the defacto IDE for devopping Microsoft Windows application (either console applications or GUI applications). In this project we use the MSBuild tool to build a basic GUI application and the WiX Toolset to create a Windows installer.

[4] Windows SDK

The Windows SDK provides libraries and tools for building Windows applications; for instance signtool.exe is the security tool we use in this project to sign the generated Windows installers.

[5] Downloads

In our case we downloaded the following installation files (see section 1):
ConEmuPack.230724.7z                    (  5 MB)
ImageMagick-7.1.0-portable-Q16-x64.zip  (111 MB)
PortableGit-2.45.2-64-bit.7z.exe        ( 44 MB)
vs_2019_community.exe                   (1.7 GB)
VSCode-win32-x64-1.91.0.zip             (131 MB)
winsdksetup.exe                         (  1 MB)
wix314-binaries.zip                     ( 39 MB)
Microsoft doesn't provide an offline installer for VS 2019 but we can follow the following instructions to create a local installer (so called layout cache) for later (re-)installation.

[6] setenv.bat usage

setenv.bat has specific environment variables set that enable us to use command-line developer tools more easily.
It is similar to the setup scripts described on the page "Visual Studio Developer Command Prompt and Developer PowerShell" of the Visual Studio online documentation.
For instance we can quickly check that the two scripts Launch-VsDevShell.ps1 and VsDevCmd.bat are indeed available in our Visual Studio 2019 installation :
> where /r "C:\Program Files (x86)\Microsoft Visual Studio" *vsdev*
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Launch-VsDevShell.ps1
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_end.bat
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_start.bat
Concretely, setenv.bat in our GitHub projects which depend on Visual Studio (e.g. michelou/cpp-examples) do invoke VsDevCmd.bat (resp. vcvarall.bat for older Visual Studio versions) to setup the Visual Studio tools on the command prompt.

mics/July 2024