PowerShell Module for MSI Creation

The WiX PowerShell module is a friendly PowerShell interface for creating straightforward Windows Installer (MSI) packages with WiX Toolset. It is designed for the jobs where you need a proper MSI but do not want to write and maintain a collection of WiX XML files by hand.

Version 2.1.0 is a substantial modernisation of the original Wix4 module. It targets WiX Toolset 7, generates readable SDK-style WiX projects and builds them using the .NET SDK. The familiar object-oriented PowerShell workflow remains, so ordinary packages can still be described in a few lines.

What can it package?

  • Selected files or complete directory trees.
  • Start menu and desktop shortcuts.
  • Add/Remove Programs icons.
  • String and integer registry values.
  • Windows services, including installation, start, stop and removal behaviour.
  • SDDL-based permissions on files and their containing folders.
  • Built-in WiX user interfaces and RTF licence pages.
  • Public install-directory property mappings.
  • Reading, adding and updating properties in existing MSI files.
  • Creating MST transforms from two MSI databases.

The module deliberately concentrates on uncomplicated installers. Complex custom actions, bundles, patches, drivers, IIS configuration and elaborate bespoke interfaces will usually require direct WiX authoring.

A complete MSI in a few lines

PowerShell
Import-Module Wix

$Wix = New-WixProject `
    -PackageName "Example Application" `
    -PackageVersion "1.0.0" `
    -Manufacturer "Example Company" `
    -PackageId "ExampleCompany.ExampleApplication" `
    -TargetPlatform "x64" `
    -OutputPath (Join-Path $PSScriptRoot "Installer") `
    -AcceptWixEula

$Wix.IncludeDirectory(
    "[ProgramFiles6432Folder]\Example Company\Example Application",
    (Join-Path $PSScriptRoot "Payload")
)

$MSI = $Wix.Build()
$MSI.FullName

The module writes the generated .wixproj and .wxs files, runs dotnet build, and returns the completed MSI as a FileInfo object ready for testing and signing.

Requirements

  • Windows PowerShell 5.1 or PowerShell 7.
  • A supported .NET SDK available on PATH.
  • Internet or internal NuGet-feed access for the first build, unless the WiX packages are already cached.
  • WiX Toolset 7 licensing appropriate for your use.

Visual Studio is no longer required. Normal MSI projects build through the WiX MSBuild SDK and dotnet build. The separate global wix .NET tool is needed only when using New-MSITransform.

WiX 7 EULA acceptance

WiX Toolset 7 requires an explicit acceptance gesture. The module will not silently accept the terms for you. Review the WiX OSMF guidance and the WiX OSMF EULA, then include -AcceptWixEula only after the appropriate person or organisation has accepted them.

When the switch is supplied, the generated WiX 7 project contains <AcceptEula>wix7</AcceptEula>. Without it, Build() stops before invoking WiX and provides links to the relevant information.

What changed in version 2.1.0?

  • WiX Toolset 7 SDK-style projects and dotnet build.
  • Stable SHA-256-derived WiX identifiers.
  • Merged destination-directory trees.
  • Explicit component, file, registry, shortcut and service identifiers.
  • Safer, parameterised Windows Installer database operations.
  • -WhatIf and -Confirm support for MSI changes and transforms.
  • Improved path handling, validation, errors and COM cleanup.
  • No automatic tool installation, Visual Studio dependency or hard-coded build paths.
  • Explicit PowerShell 5.1 and PowerShell 7 compatibility metadata.
  • Explicit WiX 7 EULA handling through -AcceptWixEula.

New-Wix4Project remains available as a compatibility wrapper for older scripts, although new projects should use New-WixProject. When migrating an existing product, retain its established UpgradeCode so Windows Installer continues to recognise the product family.

Installation

Choose whichever installation method suits the way you work:

After installation:

PowerShell
Import-Module Wix -Force
Get-Command -Module Wix

Documentation

The full technical user guide covers installation, every exported command and public project method, complete packaging scenarios, migration, CI/CD, signing, security and troubleshooting.

For a lighter introduction with worked examples, read Simplify MSI Creation with PowerShell and WiX Toolset.

Leave a Reply