如何调用wix自定义动作dll以通过合并模块使用调试运行时?

时间:2010-04-12 12:42:55

标签: visual-studio-2008 wix custom-action merge-module

我正在尝试使用相应的调试安装程序为我们的产品创建调试版本。我是Wix的新手所以请原谅我们所包含的任何天真。我项目中的调试Dll依赖于VS2008和VS2008SP1调试运行时。我在wix中创建了一个合并模块功能,将这些运行时与我的安装程序捆绑在一起。

<Include xmlns="http://schemas.microsoft.com/wix/2006/wi">


  <!-- 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> 

如果我正在进行安装程序的调试版本,我会像这样包含该功能:

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

唯一的问题是我的安装程序还包含一个自定义操作,该操作也取决于调试运行时:

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

那么如何以自定义操作也可以访问它的方式打包调试运行时?

1 个答案:

答案 0 :(得分:2)

你做不到。其中许多运行时仅在InstallFinalize中提交,这在安装结束时发生。相反,强烈建议您将CRT / ATL库静态链接到自定义操作,以便自定义操作完全自包含。