Building Connection Center add-ins using WiX - part 1

I'm writing this specifically for developers who need to add links into HealthVault Connection Center, but I think the topic is of general interest to anyone who wants to create installer packages.

We're going to be using the WiX (Windows Installer XML) toolset to create msi files.

Note 1: While I find the mixed case "WiX" name quite enjoyable, I'm just going to use "wix" in the rest of the writeup

Note 2: There are some good wiX tutorials out there that you may find useful.

Step 1: Get the tools

Find the Download section on the right side of the WIX home page. I'm basing this on the "Version 2.0 (stable)" bits. If there are newer bits, they might work, and then again, they might not.

Off of that link, you'll find a link to the binaries zip file. Unzip them, and put them in a directory (I found "g:\wix" to be an aesthetically pleasing location).

Step 2: Read the docs

I know that you're going to skip this step, just like you skipped the instructions on the new circular saw you bought last weekend.

If you want to actually read the docs, there are some in the "doc" directory, and some online. But I prefer skipping to the next step.

Step 3: Understand the tools

Wix files use the .wxs extension. If you run the wix compiler over them ("candle"), you end up with a .wixobj file. Running the wix linker ("light") generates a .msi file.

Step 4: Build your first MSI

Here are the bare-bones of a .wxs file:

 <?xml version="1.0"?>
<Wix xmlns="https://schemas.microsoft.com/wix/2003/01/wi">
  <Product Name="Fabrikam WidgetTracker"
     Id="PUT-GUID-HERE"
     Language="1033"
     Codepage="1252"
     Version="1.0.0.0"
     Manufacturer="Fabrikam"
     UpgradeCode="PUT-GUID-HERE">

    <Package
       Id="PUT-GUID-HERE"
       Description="Fabrikam users can use this to track their widgets"
       Manufacturer="Fabrikam"
       InstallerVersion="100"
       Compressed="yes"/>

  </Product>
</Wix>

Most of that is pretty self-explanatory, though I do want to talk about the IDs.

The ids are GUIDs that are used to keep track of things. I won't go into the details because I they're sorta complicated, but basically, the "id" field unique identifies the product and the package within the product. Whenever you release an MSI with any different bits, you need to have a different product id or the installer will think you've already installed it.

Packages also need to be unique, and change when their contents changes.

UpgradeCodes are also GUIDs, but should never change. They are the mechanism that the installer uses to figure out that you're doing an upgrade. If the upgrade scenario is important, you need to set it.

So, to recap, product and package ids need to be unique and generated for each release. UpdateCode should be generated once, and you use that same updatecode for the life of the product.

You do the generation with uuidgen.exe. You can download that with the Windows SDK, or use one of the online generators.

This package does very little, but the way, but you can install and unistall it.