views:

281

answers:

1

I'm trying to create a debug build with a corresponding debug installer for our product. I'm new to Wix so please forgive any naivety contained herein. The debug Dlls in my project are dependent on both the VS2008 and the VS2008SP1 debug runtimes. I've created a merge module feature in wix to bundle those runtimes with my installer.

<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"&gt;


  <!-- Include our 'variables' file -->
  <!--<?include variables.wxi ?>-->

  <!--<Fragment>-->

    <DirectoryRef Id="TARGETDIR">

      <!-- Always install the 32 bit ATL/CRT libraries, but only install the 64 bit ones on a 64 bit build -->

      <Merge Id="AtlFiles_x86"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_ATL_x86.msm"
             DiskId="1"
             Language="1033"/>
      <Merge Id="AtlPolicy_x86"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_ATL_x86.msm"
             DiskId="1"
             Language="1033"/>

      <Merge Id="CrtFiles_x86"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_DebugCRT_x86.msm"
             DiskId="1"
             Language="1033"/>
      <Merge Id="CrtPolicy_x86"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86.msm"
             DiskId="1"
             Language="1033"/>

      <Merge Id="MfcFiles_x86"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_DebugMFC_x86.msm"
             DiskId="1"
             Language="1033"/>
      <Merge Id="MfcPolicy_x86"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_DebugMFC_x86.msm"
             DiskId="1"
             Language="1033"/>


      <!-- If this is a 64 bit build, install the relevant modules -->
      <?if $(env.Platform) = "x64" ?>

      <Merge Id="AtlFiles_x64"
            SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_ATL_x86_x64.msm"
            DiskId="1"
            Language="1033"/>
      <Merge Id="AtlPolicy_x64"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_ATL_x86_x64.msm"
             DiskId="1"
             Language="1033"/>

      <Merge Id="CrtFiles_x64"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_DebugCRT_x86_x64.msm"
             DiskId="1"
             Language="1033"/>
      <Merge Id="CrtPolicy_x64"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86_x64.msm"
             DiskId="1"
             Language="1033"/>

      <Merge Id="MfcFiles_x64"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_DebugMFC_x86_x64.msm"
             DiskId="1"
             Language="1033"/>
      <Merge Id="MfcPolicy_x64"
             SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_DebugMFC_x86_x64.msm"
             DiskId="1"
             Language="1033"/>

      <?endif?>

    </DirectoryRef>

    <Feature Id="MS2008_SP1_DbgRuntime"
             Title="VC2008 Debug Runtimes"
             AllowAdvertise="no"
             Display="hidden"
             Level="1">
      <!-- 32 bit libraries -->
      <MergeRef Id="AtlFiles_x86"/>
      <MergeRef Id="AtlPolicy_x86"/>
      <MergeRef Id="CrtFiles_x86"/>
      <MergeRef Id="CrtPolicy_x86"/>
      <MergeRef Id="MfcFiles_x86"/>
      <MergeRef Id="MfcPolicy_x86"/>

      <!-- 64 bit libraries -->
      <?if $(env.Platform) = "x64" ?>
        <MergeRef Id="AtlFiles_x64"/>
        <MergeRef Id="AtlPolicy_x64"/>
        <MergeRef Id="CrtFiles_x64"/>
        <MergeRef Id="CrtPolicy_x64"/>
        <MergeRef Id="MfcFiles_x64"/>
        <MergeRef Id="MfcPolicy_x64"/>
      <?endif?>

    </Feature>

  <!--</Fragment>-->
</Include> 

If I'm doing a debug build of the installer, I include that feature like so:

<!-- The 'Feature' that contains the debug CRT/ATL libraries -->
<?if $(var.Configuration) = "Debug"?>
  <?include ..\includes\MS2008_SP1_DbgRuntime.wxi?>
<?endif?>

The only problem is that my installer also includes a custom action which is also dependent on the debug runtime:

<!-- Private key installer -->
<Binary Id="InstallPrivateKey" SourceFile="..\InstallPrivateKey\win32\$(var.Configuration)\InstallPrivateKey.dll"></Binary>
<CustomAction Id='InstallKey' BinaryKey='InstallPrivateKey' DllEntry='InstallPrivateKey'/>

So how can I package the debug run time in such a way that the custom action also has access to it?

+1  A: 

You can't. Many of those runtimes are only committed at InstallFinalize which happens at the end of the install. Instead, it is highly recommended that you statically link the CRT/ATL libraries into custom actions so the custom actions are completely self contained.

Rob Mensching