Skip to main content

MSI

Build Windows installer packages using WiX Toolset

The MSI stage builds .msi Windows installer packages from your Windows binaries using the WiX Toolset. Installers are placed in dist/windows/.

Required tools

ToolVersionNotes
wixv4Unified wix build command.
candle + lightv3Two-step compilation.

WiX v4 is preferred. If only v3 tools are found (candle and light on PATH), the v3 workflow is used automatically.

Platform

MSI only processes binary artifacts targeting Windows. Binaries for other operating systems are ignored.

WiX version auto-detection

The WiX version is determined in this order:

  1. version field — if set in config (v3 or v4), that version is used.
  2. .wxs content — if the file contains http://schemas.microsoft.com/wix/2006/wi, WiX v3 is selected; the http://wixtoolset.org/schemas/v4/wxs namespace or no namespace defaults to v4.
  3. Installed tools — checks for wix (v4) then candle (v3) on PATH.

Minimal config

crates:
  - name: myapp
    msis:
      - wxs: installer/myapp.wxs

Config fields

FieldTypeDefaultDescription
idstringUnique identifier for referencing this config from other stages.
idslistallFilter to specific build IDs.
wxsstringrequiredPath to the WiX source file (.wxs). Rendered through the template engine.
namestring<ProjectName>_<Version>_<MsiArch>.msiOutput filename template.
versionstringautoWiX schema version: v3 or v4. Auto-detected if omitted.
replaceboolfalseRemove matching archive artifacts, keeping only the MSI.
mod_timestampstringFixed timestamp for reproducible builds.
disableboolfalseSkip this MSI config.

Template variables in .wxs

The .wxs file is rendered through the Tera template engine before being passed to WiX. Available variables include:

VariableDescription
{{ ProjectName }}Project/crate name.
{{ Version }}Release version.
{{ Arch }}Architecture: amd64, arm64, etc.
{{ MsiArch }}MSI architecture identifier: x64, x86, arm64.
{{ BinaryPath }}Full path to the binary being packaged.
{{ Os }}Operating system (windows).
{{ Tag }}Git tag.

Architecture mapping

Build archMSI arch
amd64 / x86_64x64
386 / i686 / i386x86
arm64 / aarch64arm64

WiX v4 build command

wix build installer/myapp.wxs -o dist/windows/myapp_1.0.0_x64.msi

WiX v3 build commands

candle -nologo installer/myapp.wxs -o dist/windows/myapp_1.0.0_x64.wixobj
light  -nologo dist/windows/myapp_1.0.0_x64.wixobj -o dist/windows/myapp_1.0.0_x64.msi

Full example

crates:
  - name: myapp
    msis:
      - wxs: installer/myapp.wxs
        name: "{{ ProjectName }}_{{ Version }}_{{ MsiArch }}.msi"
        version: v4
        replace: true
        mod_timestamp: "{{ .CommitTimestamp }}"

Minimal .wxs template (WiX v4)

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
  <Package Name="{{ ProjectName }}"
           Version="{{ Version }}"
           Manufacturer="My Company"
           UpgradeCode="YOUR-UPGRADE-GUID-HERE">
    <MajorUpgrade DowngradeErrorMessage="A newer version is already installed." />
    <MediaTemplate EmbedCab="yes" />
    <Feature Id="ProductFeature">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component>
        <File Source="{{ BinaryPath }}" />
      </Component>
    </ComponentGroup>
  </Package>
</Wix>