Search code examples
.netwixwindows-installerinstallationheat

How to include the output of heat in a wix file? (No Visual Studio project)


I need to build an installer and, for a variety of reasons, I would like to avoid using the WiX project template. I'm perfectly happy to script this stuff myself and already have a custom build process for this to fit into.

I believe I understand the role of WiX candle, heat, and light tools fine, I'm getting familiar with the wxs file format, and I can run heat to produce the file fragment outputs that I want. I have no idea however how to incorporate that into my wxs file. Presumably at some point I would have a reference in the wxs to the file fragment file...but I can't quite figure out what the right syntax is here.


Solution

  • In your wxs file where you describe the target directory structure, add a directory node under TARGETDIR, like this:

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="DYNAMIC" Name="Dynamic">
    

    In your wxs file where you list referenced components for your features, add a component group reference:

    <Feature Id="MyFeature">
        <ComponentGroupRef Id="MyComponentGroup"/>
    

    Call heat like this (add more parameters to your fancy):

    "C:\WIX\bin\heat.exe" dir "C:\SourceDir" -cg MyComponentGroup -ke -srd -dr DYNAMIC -sfrag -o "C:\MyProject\Dynamic.wxs"
    

    Add this Dynamic.wxs to your Candle call. Add its result (wixobj) to your Light call.