Skip to content

kurtanr/WiXInstallerExamples

Repository files navigation

WiX Installer Examples

msi-build License

WiX (Windows Installer XML) is a framework that lets developers create installers (MSIs) for Windows.
The Repository contains multiple sample installers which demonstrate how to achieve various tasks using WiX.
Examples use version 3.14.1 of WiX.

How to get WiX

Download binaries using PowerShell from WiX GitHub (installer is also available):

$source = 'https://github.com/wixtoolset/wix3/releases/download/wix314rtm/wix314-binaries.zip'
$destination = Join-Path $PSScriptRoot -ChildPath 'wix314-binaries.zip'
Invoke-WebRequest -Uri $source -OutFile $destination

Download from Chocolatey:

choco install wixtoolset

Download NuGet package:

Install-Package wix -Version 3.14.1

How to build installers using WiX

Tools that come with WiX are enough to build installers. VisualStudio/MSBuild is not required, but it helps (e.g. IntelliSense support, project templates).
Extensions that integrate WiX Toolset into Visual Studio are available from Visual Studio 2010 onward.

There are several options for building a WiX project on a machine that does not have WiX Toolset Build Tools installed.
One of them is described here: Integrating WiX Projects Into Daily Builds
Another is to simply use the WiX NuGet package (this is what all projects from 01_HelloWorldInstallerUpgradable onward use).

List of example projects

Project/folder name Description
00_HelloWorldInstaller - minimum installer, not upgradable
- does not use wixproj
01_HelloWorldInstallerUpgradable - minimum installer, upgradable, no ICE warnings
- uses wixproj
02_x86_x64_Installer - single wxs file used for building x86 and x64 MSI
- x86 and x64 MSI deploy different files and write to different registry locations
03_PassingInstallLocationParameterToInstaller - passing parameters to installer using msiexec
- analyzing installation log and using the Orca MSI Editor
04_PowerShellPreconditionCustomAction - checking precondition for installation (is PowerShell installed)
- overview of install stages
- executing PowerShell script as a custom action
05_RememberPropertyPattern - implementation of "Remember Property" pattern
- example of how to define custom actions that execute only during upgrade/repair/uninstall
- these actions are accessing properties set during the initial installation
06_RememberPropertyPatternComplete - modification of the previous example to additionally support changing of property values during upgrade
07_CSharpCustomAction - example of C# code executed as a custom action during installation (immediate and deferred)
08_CppCustomAction - example of C++ code executed as a custom action during installation (immediate and deferred)
09_InstallerWithUserInterface - example of an installer with a user interface
- user is able to choose install location and set value of a custom property
10_ASP.NET_Core6_WeatherForecastInstaller - example of installer for ASP.NET Core 6 web application
- example of installer which is deploying the web application in Kestrel and in IIS

Additional reading