Search code examples
wixheatmerge-module

Reference a heat generated wxs file from a merge module


I want to create a trivial merge module that contains all the files of a directory called "build" and installs them to the program files folder. I will use heat to generate a wxs file with all these files, and I want this to be separated from the wxs file I edit manually for the merge module. How do I reference the heat generated file from my other merge module wxs file?

I generate my heat wxs file like this:

heat dir build -cg heatComponent -gg -var var.buildFolder -dr ProgramFilesFolder -srd -out heatComponent.wxs

I know how to create an msi file of this:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Name='product' Id='9f6edf70-539a-11e4-916c-0800200c9a66' UpgradeCode='bb651370-539a-11e4-916c-0800200c9a66'
        Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Test'>
        <Package Id='*' Description="A product" InstallerVersion='301' Languages='1033'       Compressed='yes' SummaryCodepage='1252' Platform='x64'/>

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

        <Directory Id='TARGETDIR' Name='SourceDir'>
            <Directory Id='ProgramFilesFolder'/>
        </Directory>

        <Feature Id="Files" Title="Main Feature" Level="1">
            <ComponentGroupRef Id="heatComponent"/>
        </Feature>
    </Product>
</Wix>

But how do I do reference the ComponentGroup when I want to output a merge module? If I change the Product element to a Module element it complaints about the Feature element. If I remove that it works, but I do not get any files in my msm.


Solution

  • Based on the heat command you posted, try making your module definition (module1.wxs) look something like this:

    <?xml version="1.0" encoding="utf-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
      <Module Id="Mod1" Language="0" Version="1.0.0">
        <Package Id="YOUR-GUID" Manufacturer="Acme" />
        <Directory Id="TARGETDIR" Name="SourceDir">
          <Directory Id="ProgramFilesFolder" />
        </Directory>
        <ComponentGroupRef Id="heatComponent"/>
      </Module>
    </Wix>
    

    Then you can call candle like so:

    candle module1.wxs heatComponent.wxs -dbuildFolder="FOLDER-CONTAINING-FILES-HERE"
    

    Followed by light like so:

    light module.wixobj heatComponent.wixobj -o Module1.msm