Skip to content

Instantly share code, notes, and snippets.

@richardlau
Last active July 2, 2021 15:19
Show Gist options
  • Save richardlau/87ccbe64494411c5670b1e4a3110a3c6 to your computer and use it in GitHub Desktop.
Save richardlau/87ccbe64494411c5670b1e4a3110a3c6 to your computer and use it in GitHub Desktop.
Setting up WiX... the hard way

Setting up WiX... the hard way

Background

WiX Toolset is used to build .msi installers for Node.js. The usual way to install WiX is to download and run the installer. This requires .NET Framework 3.5.1. Attempting to install without that results in:

WiX Toolset requires the .NET Framework 3.5.1 Windows feature to be enabled.

Enabling the feature can fail if the computer has been configured to get updates from a WSUS server instead of Windows Update.

Installing WiX without using the installer

The WiX project provides instructions on integrating WiX into a build process without preinstalling it. WiX releases also provide a zip file containing the WiX binaries and SDK. After unzipping the instructions detail modifying the WiX project files -- the rest of this document details how to set up your environment to avoid having to modify the Node.js WiX project files.

Assuming WiX was unzipped into c:\Program Files (x86)\WiX Toolset v3.11\ (requires admininstrator privileges):

Environment variables

Set these variables -- either as system/user environment variables or in the VS Dev command prompt session.

Name Value
WIX c:\Program Files (x86)\WiX Toolset v3.11 -- Point to the unzipped directory
WixTargetsPath c:\Program Files (x86)\WiX Toolset v3.11\Wix.targets
WixTasksPath c:\Program Files (x86)\WiX Toolset v3.11\WixTasks.dll
WixToolPath c:\Program Files (x86)\WiX Toolset v3.11\ -- Must end in a \

Set up the include directory

You will need to create the include directory so that the custom actions in the Node.js project can find the WiX SDK headers. Either copy or symlink an incdirectory under the SDK directory, e.g. C:\Program Files (x86)\WiX Toolset v3.11\SDK\VS2017\inc (WiX doesn't have a SDK directory for VS2019 -- Node.js uses the one for VS2017).

mklink /j "C:\Program Files (x86)\WiX Toolset v3.11\SDK\VS2017\inc" "c:\Program Files (x86)\WiX Toolset v3.11\sdk\inc"

WiX Toolset Visual Studio 2019 Extension

In addition to the WiX toolset you also need to install the extension into Visual Studio. This is a seperate installer, available on the Visual Studio Marketplace, and does not need .NET Framework 3.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment