2

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.

George Mauer
  • 117,483
  • 131
  • 382
  • 612

1 Answers1

5

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.

BBR
  • 690
  • 6
  • 10
  • Addressing referencing the file or fragment points in the question, you don't reference it as a whole; You just reference the elements that it contains, e.g., `ComponentGroupRef`. Of course, you pass the file as a source, too. – Tom Blodget Aug 06 '16 at 14:35
  • Thanks, I *think* I figured out how to make it work and you helped me. Now I've got a fuller question though: http://stackoverflow.com/questions/38858803/invalid-defaultdir-when-running-light-in-wix – George Mauer Aug 09 '16 at 19:21