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:



