WiX

Windows Installer XML (WiX) toolset has released as Open Source on SourceForge.net

The Windows Installer Xml (WiX) toolset (pronounced "wicks toolset") appears to have finished propagating around the SourceForge.net CVS servers, so I can finally start writing this blog entry.

As promised in my blog here, here, here, here, and here the WiX toolset and all of its source code has been released so that you can build Windows Installer databases (MSI and MSM files) the same way most groups inside Microsoft do. However, a funny thing happened on the way to the forum. WiX became the first project from Microsoft to be released under an OSS approved license, namely the Common Public License.

Before everyone gets sidetracked by the Open Source implications, let’s talk about exactly what WiX is. WiX is a toolset composed of a compiler, a linker, a lib tool and a decompiler. The compiler, called candle, is used to compile XML source code into object files that contain symbols and references to symbols. The linker, called light, is fed one or more object files and links the references in the object files to the appropriate symbols in other object files. Light is also responsible for collecting all of the binaries, packaging them appropriately, and generating the final MSI or MSM file. The lib tool, called lit, is an optional tool that can be used to combine multiple object files into libraries that can be consumed by light. Finally, the decompiler, called dark, can take existing MSI and MSM files and generate XML source code that represents the package.

So, let me step through a real quick example before sending you off to the SourceForge project to get the binaries and source code. First, the below is a complete source file that will create a MSI file that installs a test .NET Assembly into the “Program Files\Test Assembly” directory.

<?xml version='1.0'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>
  <Product Id='000C1109-0000-0000-C000-000000000046'
           Name='TestAssemblyProduct' Language='1033'
           Version='0.0.0.0' Manufacturer='Microsoft Corporation'>
    <Package Id='000C1109-0000-0000-C000-000000000046'
             Description='Test Assembly in a Product'
             Comments='Test from: wix\examples\test\assembly\product.wxs'
             InstallerVersion='200' Compressed='yes' />

    <Media Id='1' Cabinet='product.cab' EmbedCab='yes' />

    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
        <Directory Id='TestAssemblyProductDirectory' Name='testassm' 
                   LongName='Test Assembly'>
          <Component Id='TestAssemblyProductComponent'
                     Guid='00030829-0000-0000-C000-000000000046'>
            <File Id='TestAssemblyProductFile' Name='assembly.dll'
                  Assembly='.net' KeyPath='yes' DiskId='1'
                  src='$(env.WIX)\examples\data\assembly.dll'/>
          </Component>
        </Directory>
      </Directory>
    </Directory>

    <Feature Id='TestAssemblyProductFeature' Level='1'
             Title='Test assembly Product Feature'>
      <ComponentRef Id='TestAssemblyProductComponent' />
    </Feature>
  </Product>
</Wix>

Now, to build the MSI file we compile and link the source code like so:

E:\wix\examples\test\assembly> candle.exe product.wxs
Microsoft (R) Windows Installer Xml Compiler version 2.0.1510.0
Copyright (C) Microsoft Corporation 2003. All rights reserved.

product.wxs

E:\wix\examples\test\assembly> light.exe product.wixobj
Microsoft (R) Windows Installer Xml Linker version 2.0.1510.0
Copyright (C) Microsoft Corporation 2003. All rights reserved.

E:\wix\examples\test\assembly> dir

Volume in drive E is New Volume
Volume Serial Number is 8AC4-6AD2
Directory of E:\wix\examples\test\assembly

04/05/2004 05:04 <DIR>        .
04/05/2004 05:04 <DIR>        ..
02/23/2004 09:55                891 module.wxs
04/05/2004 05:04             52,736 product.msi
04/05/2004 05:04              4,976 product.wixobj
02/23/2004 09:55              1,281 product.wxs
              4 File(s) 59,884 bytes
              2 Dir(s) 90,014,191,616 bytes free

E:\wix\examples\test\assembly>

I’ll discuss more complicated examples in future blog entries and update the documentation (WiX.chm) by distilling any discussions here. While we’re on the topic of documentation, let’s discuss where WiX is in its product life-cycle.

First of all, I would say that the WiX toolset is pretty close to Beta2 quality. That means core scenarios (compiling/linking) are very solid, less core scenarios (lib’ing/decompiling) still have some bugs, and the documentation leaves much to be desired. Part of my motivation for pushing the toolset external to Microsoft is to encourage me (and maybe find others) to update the documentation. I’ll talk more about that in future blog entries.

That said production quality MSI and MSM files can be produced from the WiX toolset today. Internally, teams such as Office, SQL Server, BizTalk, Virtual PC, Instant Messenger, several msn.com properties, and many others use WiX to build their MSI and MSM files today. When someone encounters a bug, the community tracks the issue down and fixes it. Now, via SourceForge.net, you have an opportunity to be a part of the community as well.

Now, let’s talk about why WiX was released as Open Source. First, working on WiX has never been a part of my job description or review goals. I work on the project in my free time. Second, WiX is a very developer oriented project and thus providing source code access increases the pool of available developers. Today, there are five core developers (Robert, K, Reid, and Derek, thank you!) regularly working on WiX in their free time with another ten submitting fixes occasionally. Finally, many parts of the Open Source development process appeal to me. Back in 1999 and 2000, I did not feel that many people inside Microsoft understood what the Open Source community was really about and I wanted to improve that understanding by providing an example.

After four and a half years of part-time development, the WiX design (and most of the code) matured to a point where I was comfortable trying to release it externally. So, last October I started looking for a means to release not only the tools but the source code as well. I thought GotDotNet was the place. However, at that time, none of the existing Shared Source licenses were flexible enough to accept contributions from the community. Then, in February, I was introduced to Stephen Walli who was also working to improve Microsoft’s relationship with the Open Source community. Fortunately, Stephen was much farther along than I and had the step-by-step plan how to release an Open Source project from Microsoft using an approved OSS license.

Today, via WiX on SourceForge, you get to see the results of many people’s efforts to improve Microsoft from the inside out. I’m not exactly sure what is going to happen next but I’m sure there are quite a few people who are interested to see where this leads. Personally, all I hope is that if you find the WiX toolset useful then you’ll join the community and help us improve the toolset.