title: How can a wix custom action dll call be made to use the debug runtime via a merge module?
body: <p>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.</p>
  
  <pre><code>&lt;Include xmlns="http://schemas.microsoft.com/wix/2006/wi"&gt;
  
  
    &lt;!-- Include our 'variables' file --&gt;
    &lt;!--&lt;?include variables.wxi ?&gt;--&gt;
  
    &lt;!--&lt;Fragment&gt;--&gt;
  
      &lt;DirectoryRef Id="TARGETDIR"&gt;
  
        &lt;!-- Always install the 32 bit ATL/CRT libraries, but only install the 64 bit ones on a 64 bit build --&gt;
  
        &lt;Merge Id="AtlFiles_x86"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_ATL_x86.msm"
               DiskId="1"
               Language="1033"/&gt;
        &lt;Merge Id="AtlPolicy_x86"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_ATL_x86.msm"
               DiskId="1"
               Language="1033"/&gt;
  
        &lt;Merge Id="CrtFiles_x86"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_DebugCRT_x86.msm"
               DiskId="1"
               Language="1033"/&gt;
        &lt;Merge Id="CrtPolicy_x86"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86.msm"
               DiskId="1"
               Language="1033"/&gt;
  
        &lt;Merge Id="MfcFiles_x86"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_DebugMFC_x86.msm"
               DiskId="1"
               Language="1033"/&gt;
        &lt;Merge Id="MfcPolicy_x86"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_DebugMFC_x86.msm"
               DiskId="1"
               Language="1033"/&gt;
  
  
        &lt;!-- If this is a 64 bit build, install the relevant modules --&gt;
        &lt;?if $(env.Platform) = "x64" ?&gt;
  
        &lt;Merge Id="AtlFiles_x64"
              SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_ATL_x86_x64.msm"
              DiskId="1"
              Language="1033"/&gt;
        &lt;Merge Id="AtlPolicy_x64"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_ATL_x86_x64.msm"
               DiskId="1"
               Language="1033"/&gt;
  
        &lt;Merge Id="CrtFiles_x64"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_DebugCRT_x86_x64.msm"
               DiskId="1"
               Language="1033"/&gt;
        &lt;Merge Id="CrtPolicy_x64"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_DebugCRT_x86_x64.msm"
               DiskId="1"
               Language="1033"/&gt;
  
        &lt;Merge Id="MfcFiles_x64"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC90_DebugMFC_x86_x64.msm"
               DiskId="1"
               Language="1033"/&gt;
        &lt;Merge Id="MfcPolicy_x64"
               SourceFile="$(env.CommonProgramFiles)\Merge Modules\policy_9_0_Microsoft_VC90_DebugMFC_x86_x64.msm"
               DiskId="1"
               Language="1033"/&gt;
  
        &lt;?endif?&gt;
  
      &lt;/DirectoryRef&gt;
  
      &lt;Feature Id="MS2008_SP1_DbgRuntime"
               Title="VC2008 Debug Runtimes"
               AllowAdvertise="no"
               Display="hidden"
               Level="1"&gt;
        &lt;!-- 32 bit libraries --&gt;
        &lt;MergeRef Id="AtlFiles_x86"/&gt;
        &lt;MergeRef Id="AtlPolicy_x86"/&gt;
        &lt;MergeRef Id="CrtFiles_x86"/&gt;
        &lt;MergeRef Id="CrtPolicy_x86"/&gt;
        &lt;MergeRef Id="MfcFiles_x86"/&gt;
        &lt;MergeRef Id="MfcPolicy_x86"/&gt;
  
        &lt;!-- 64 bit libraries --&gt;
        &lt;?if $(env.Platform) = "x64" ?&gt;
          &lt;MergeRef Id="AtlFiles_x64"/&gt;
          &lt;MergeRef Id="AtlPolicy_x64"/&gt;
          &lt;MergeRef Id="CrtFiles_x64"/&gt;
          &lt;MergeRef Id="CrtPolicy_x64"/&gt;
          &lt;MergeRef Id="MfcFiles_x64"/&gt;
          &lt;MergeRef Id="MfcPolicy_x64"/&gt;
        &lt;?endif?&gt;
  
      &lt;/Feature&gt;
  
    &lt;!--&lt;/Fragment&gt;--&gt;
  &lt;/Include&gt; 
  </code></pre>
  
  <p>If I'm doing a debug build of the installer, I include that feature like so:</p>
  
  <pre><code>&lt;!-- The 'Feature' that contains the debug CRT/ATL libraries --&gt;
  &lt;?if $(var.Configuration) = "Debug"?&gt;
    &lt;?include ..\includes\MS2008_SP1_DbgRuntime.wxi?&gt;
  &lt;?endif?&gt;
  </code></pre>
  
  <p>The only problem is that my installer also includes a custom action which is also dependent on the debug runtime:</p>
  
  <pre><code>&lt;!-- Private key installer --&gt;
  &lt;Binary Id="InstallPrivateKey" SourceFile="..\InstallPrivateKey\win32\$(var.Configuration)\InstallPrivateKey.dll"&gt;&lt;/Binary&gt;
  &lt;CustomAction Id='InstallKey' BinaryKey='InstallPrivateKey' DllEntry='InstallPrivateKey'/&gt;
  </code></pre>
  
  <p>So how can I package the debug run time in such a way that the custom action also has access to it?</p>