Tim Murphy's .NET Software Architecture Blog

August 2014 Entries

Getting Started With WiX


Up until this week I had not even heard of WiX (Windows Installer XML Tools).  As with most open source projects I found myself spending a large amount of time trying to find resources to explain how to use this tool.  I figured if I was struggling there might be a few others that could use some help.  In this post I will cover a number of topics to get you started with WiX.

First thing you need is the toolset itself.  You can get it here.  Once you run the install be sure to restart your machine so that the new templates will show up in Visual Studio.

Now that we have the tools you are on your own.  I found a video that gives you the absolute minimum information required to create the equivalent of a “Hello World” install.  Of course there are a number of things that the video does not cover and I will address a couple of those below.

The WiX toolset has a set of default dialogs, all of which are customizable.  The one that I think is useful to the most people is WixUI_InstallDir.  This simply has the user accept a EULA and then allows them to set the install directory for your software.  This feature can be added by including the WixUIExtension assembly and adding the following namespace attribute to the Wix tag in the wxs file.


When you use the Install Directory extension it comes with a generic license.   You can customize it by simply adding an RTF file with your text and referencing it in the main wxs file inside the product tag.  It looks like this.

<WixVariable Id="WixUILicenseRtf" Value="MyLicense.rtf" />

Likewise the banner image at the top of the installer can be changed with a similar entry.

<WixVariable Id="WixUIBannerBmp" Value="..\Secure PDF\Library\Banner_PwC.bmp" />

Additionally you may want to check if a particular version of the .NET framework is installed.  The simple setup template allows you to do this if you reference the WixNetFXExtension assembly and add its namespace reference.  If you want to actually install a framework you need to use Bootstrap project template.  In order to do the actual check you will need to add the following tags.  The location doesn’t seem to matter but I put them inside the product tag.

<PropertyRef Id="NETFRAMEWORK20"/>
<Condition Message="This application requires .NET Framework 2.0. Please install the .NET Framework then run this installer again.">
  <![CDATA[Installed OR NETFRAMEWORK20]]>

In all WiX is a very useful and flexible tool and since Visual Studio 2013 no longer provides installer projects you will need to learn these tools.  Hopefully these hints will help you get started.