Luke Melia

software dev

September 30, 2005

Wix fragment component generation

In order to get Wix to generate good MSIs, you can have no more than one DLL/EXE per component. In addition, each component needs it’s own GUID. My team wanted a way to automate the definition of these components for our .NET apps as part of our automated build process. We tried using tallow/mallow, but that didn’t really work out too well for us.

Here’s the solution we came up, in a nutshell: a custom nant task runs against a build directory and catalogs all files in an XML file. Special logic applies for DLLs and EXEs, which get inspected and have relevant metadata added to thir elements in the XML. Once we have this XML, we apply an XSLT which transforms it into a Wix-friendly fragment file. We made one XSLT for executables, and another one for web services. We activate this XSLT as part of our nant script, and then included it in the call to Wix.

I’m including code listings for the relevant files here. It’s available for use under a BSD license, which I’ll include at the bottom.

The nant custom task: “BuildOutputToXmlTask.cs”

The XSLT for transforming a Windows executable project: “OutputToComponents.xslt”:

The XSLT for transforming a web service project:

A snippet of a nant build file showing the use of this code:

Copyright and open source license:

3 Responses to “Wix fragment component generation”

  1. Cash Foley chimed in:

    Really good looking stuff. I’ve been doing CI, NAnt development for about 2 years and it’s nice to see someone doing it right.


  2. Tim chimed in:


    I’m really interested in using a similar setup but have had endless trouble trying to combine the Component.wxs file with a base wix file to correctly setup an MSI. Is it possible to reveal some of the ClientInstaller.wxs file to see how it includes the generated Component.wxs

  3. Andrew Janssen chimed in:

    Thanks very much for this! I was thinking about writing this same thing myself, but you’ve saved me a ton of pain and time. Thank you.

Leave a Reply created 1999. ··· Luke Melia created 1976. ··· Live With Passion!