Using WiX to build Windows installers

All Windows applications need to be installed. Sure, you can just wrap your binaries and assets in a zip file and leave installation as an exercise for your users, but that means they’re unlikely to ever come back. That’s where the various Windows packaging and installer tools come in, giving you a way to build executables that place all the various elements of your code in the right place in a Windows install, ensuring that all the necessary dependencies are installed, and icons and shortcuts are in the start menu, ready to go.

How do you go about building an installer? Many of the tools out there take advantage of the standard Windows Installer packaging tools, but getting that configuration right can be hard, especially when you’re making packaging the final part of a CI/CD (continuous integration and continuous delivery) build process. When your code, artifacts, and dependencies change from build to build, you need a scriptable configuration environment that can be managed by your build tools, integrated into your development environment and your code repository.

The first Microsoft open source tool was for developers

That’s where WiX, the Windows Installer XML toolset, comes into play. It’s been used inside Microsoft for a long time and made history as its first open source release in 2004 using the Common Public License, eventually being managed by the Outercurve Foundation before being transferred to the .NET Foundation. Development has continued through that period, with the project leads founding FireGiant to provide commercial support and additional tools.

At its heart, WiX is XML that’s used as declarative code that’s treated as source for building installers. You can install the WiX tools in Visual Studio and write an installer alongside your application, using the same source control and build tools to ship an installable package. It’s able to do more than the basic Windows Installer, with support for application and Windows configuration and the capability to work with server tools such as IIS and SQL Server. Additionally, it can create complex setup bundles that handle dependencies and prerequisites, ensuring that your code has everything it needs to run once installed.

The current stable release of WiX is Version 3.11.2, which has been available since 2019. That gap is due to the development team focusing on a new version with a new architecture. A preview of WiX 4.0 is now available and is well worth investigating. Built on modern .NET, it’s more suitable for use in a modern CI/CD environment. Everything is run from the .NET command line, allowing you to quickly build it into scripts and actions; it works as part of an Azure DevOps pipeline or in a GitHub Action. Push a new pull request to a branch and get a ready-to-run installer.

Downloading and installing WiX

 You can download the current release of the WiX toolset from GitHub, which is where most development occurs. There are repositories for the toolset, the Visual Studio extension, and core tools that ship as part of the platform. It’s a reasonably active set of repositories, with most of the current tools in maintenance mode while much of the work goes into the upcoming WiX 4.

Copyright © 2021 IDG Communications, Inc.

Source link

Leave a Comment

Your email address will not be published. Required fields are marked *