2

I would like to write and use a minimal retargetable merge module. It should contain 3 files

PS C:\Users\mto\sandbox\wixme3> Get-ChildItem files


Directory: C:\Users\mto\sandbox\wixme3\files


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-----        16.02.2015     18:08          0 a
-----        16.02.2015     18:08          0 b
-----        16.02.2015     18:08          0 c

I have the following merge module:

PS C:\Users\mto\sandbox\wixme3> Get-Content .\MergeModule.wxs
<?xml version="1.0" encoding="UTF-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Module Id="a_merge_module" Language="1033" Version="1.0.0.0">
        <Package Id="92b702f4-8687-4bbf-b8c2-24c42be52730" Manufacturer="Me" Description="a merge module" InstallerVersion="300" Platform="x86"></Package>
        <ComponentGroupRef Id="allTheFilesINeed"/>
        <Directory Id='TARGETDIR' Name='SourceDir'>
        </Directory>
    </Module>
</Wix>

I use it like this:

PS C:\Users\mto\sandbox\wixme3> Get-Content .\Product.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Name='TestRelocatableMergeModule' Id='d5c54f50-52df-11e4-916c-0800200c9a66' UpgradeCode='e07a1cf0-52df-11e4-916c-0800200c9a66'
         Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Me'>
        <Package Id='*' Keywords='Installer' Description="test merge module"
          Comments='Test Installer' Manufacturer='Acme Ltd.'
          InstallerVersion='301' Languages='1033' Compressed='yes' SummaryCodepage='1252' Platform='x86'/>

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

        <Directory Id='TARGETDIR' Name='SourceDir'>
            <Directory Id="SOMETHING" Name="my_special_folder">
            </Directory>
        </Directory>
        <DirectoryRef Id="SOMETHING">
            <Merge Id="merge" Language="1033" SourceFile="merge_module.msm" DiskId="1" />
        </DirectoryRef>
        <Feature Id="Msm" Title="Msm" Level="1">
            <MergeRef Id="merge" />
        </Feature>
    </Product>
</Wix>

and stitch it together like this:

PS C:\Users\mto\sandbox\wixme3> Get-Content .\makeInstaller.cmd
del *.wixobj
del allTheFilesINeed.wixobj
del allTheFilesINeed.wxs
del *.msi
del *.msm
heat.exe dir "files" -cg allTheFilesINeed -var var.BUILDFOLDER -gg -g1 -srd -sfrag -o allTheFilesINeed.wxs
candle.exe -dBUILDFOLDER="files" allTheFilesINeed.wxs MergeModule.wxs -v
candle.exe Product.wxs
light.exe -dBUILDFOLDER="files" allTheFilesINeed.wixobj MergeModule.wixobj -o merge_module.msm
light.exe Product.wixobj -o product.msi

This does not work as expected. The folder in Product.wxs is ignored and the files goes directly under C:\. I have read that I need to use a retargetable merge module. The merge module should then use a configuration setting to decide where to put it's files. This configuration should be set in the product that uses the merge module. I have not been able to find an example of how to do this. Can anyone point me in the right direction?

toftis
  • 1,070
  • 9
  • 26

1 Answers1

0

Use

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

And refer this directory in your merge module components.