[wix-users] How to link fragment into a module to produce merge module

Andres Armengol andres.armengol at pantec.com
Tue Nov 8 00:41:04 PST 2016


No problem!

Feature is only possible to define on Product and not on Module level, but I find out that the ComponentGroupRef can be directly a child of Module.
 At the end the small test did work as follows:

Harvest tool (heat) command to generate Source.wxs from the files in bin directory:
"C:\Program Files (x86)\WiX Toolset v3.10\bin\heat" dir "bin" -srd -dr MergeRedirectFolder -cg SourceGroup -gg -var var.MySource -out Source.wxs

Generated Source.wxs looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="MergeRedirectFolder" />
    </Fragment>
    <Fragment>
        <ComponentGroup Id="SourceGroup">
            <Component Id="cmpF56A1B1535C9F445E8AD0F11DFCFFCB0" Directory="MergeRedirectFolder" Guid="{3AACC873-5161-419F-9129-A27D4E9FF612}">
                <File Id="fil0409728AB4C1AF8A5BBF6827EFE44F62" KeyPath="yes" Source="$(var.MySource)\File1.txt" />
            </Component>
            <Component Id="cmpE95FEC934BCB1FBB142E9141695A37CA" Directory="MergeRedirectFolder" Guid="{37A41414-7E1B-4B77-BFDE-52579356A2B9}">
                <File Id="filC22FD27FBD5B9756A42B34E97CAF651D" KeyPath="yes" Source="$(var.MySource)\File2.txt" />
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

MergeModule.wxs:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Module Id="Setup.msm.Sample" Language="1033" Version="1.0.0.0">
    <Package Id="4dff7c85-ce0a-43c8-bf53-820c3974c648" Manufacturer="Acme co." InstallerVersion="200" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="MergeRedirectFolder">
      </Directory>
    </Directory>

    <ComponentGroupRef Id="SourceGroup"/>
  </Module>
</Wix>

Commands to build the merge module:
"C:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -dMySource=.\bin\ MergeModule.wxs Source.wxs
"C:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -out sample.msm MergeModule.wixobj Source.wixobj




More information about the wix-users mailing list