Creating Professional Installers with Wix#

Back to Listing

Creating Professional Installers with Wix#

12 May, 2010

Here at work we have a fairly strict deployment story. As you can imagine with any financial company, when dealing with other people’s money mistakes are punishable by death. Having a failed rollout because your 37 page install document wasn’t completely accurate and left out some minor detail that prevented the server administrator from continuing is a pretty big mistake.

To mitigate this risk, we as developers try to control and automate as much of our deployments as possible. Some of the strategies we use include:

  • Automated build that produces a deployment package that is rigorously tested for completeness
  • A single rollout script to be run in SQL server that is tested with every build
  • Heavy use of PowerShell scripts to automate complex tasks like setting up MSMQ queues
  • Deployment of applications using MSI installers built with Wix Wix or Windows Installer XML, is a great tool for creating very high quality, professional looking installers. The down side is that it has a learning curve steeper than Everest and suffers from severe angle bracket tax. It is not uncommon to struggle for several days trying to get a Wix based MSI to do all the little things you want it to accomplish for you.

To get over these hurdles you need a solid foundation of knowledge and a really nice abstraction layer. Kevin Miller has laid out the solid foundation for us in his series from 2007 called Creating Windows Installers Using WIX. I highly suggest reading it and walking through your own project using the raw Wix model.

When you are done with that, let me introduce you to a really nice abstraction layer. Oleg Shilo’s Wix# project allows you to define your installation package in C#, you know, a general purpose programming language that is designed to model real world processes. Not a markup language like XML. Seriously, if I could go back to 2001 and find the guy that decided that XML was the solution to all problems and beat him senseless, I would.

Go back to Mr. Miller’s great articles and compare his Wix XML to this:

using System;  
using WixSharp;

class Script  
    static public void Main(string[] args)
        var project = new Project("MyProduct",
                          new Dir(@"%ProgramFiles%\My Company\My Product",
                              new Files(@"Release\*.*”));

        project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");


This is the simplest possible use of Wix#, but 8 lines of code damn sure beats the gratuitous ceremony of using Wix XML directly. Mr. Shilo’s project comes out of the box with 39 samples that demonstrate using this tool kit to do everything from creating virtual directories in IIS to editing the registry to forcing a reboot after installation. And there is a great introduction to the project on CodeProject.

It is difficult to tell how active the development is on Wix#, but Mr. Shilo does have the full source available from the projects page. I would be interested in seeing this project move out to a public repository like GitHub and seeing more community involvement. What do you say, Oleg? Let’s blow the roof off this mofo!

Share this story

Bobby Johnson

About Author

I am a passionate engineer with an interest in shipping quality software, building strong collaborative teams and continuous improvement of my skills, team and the product.

comments powered by Disqus
Back to top