使用WiX安装带有自定义操作的预构建可执行文件 我试图让我正在安装的安装程序安装VisualC++ 2012包,这样终端用户就不必单独做了。p>

使用WiX安装带有自定义操作的预构建可执行文件 我试图让我正在安装的安装程序安装VisualC++ 2012包,这样终端用户就不必单独做了。p>,wix,Wix,可执行文件位于安装目录中,但当我构建安装程序时,我收到一个错误,说明系统找不到该文件 下面是与我的安装程序相关的代码块。如果有多处错误,请提前道歉。我刚开始被WiX弄湿了脚 <Binary Id="MyVC" SourceFile="[INSTALLDIR]vcredist_x64.exe"/> <CustomAction Id='VCInstall' BinaryKey="MyVC" ExeCommand='

可执行文件位于安装目录中,但当我构建安装程序时,我收到一个错误,说明系统找不到该文件

下面是与我的安装程序相关的代码块。如果有多处错误,请提前道歉。我刚开始被WiX弄湿了脚

<Binary Id="MyVC" SourceFile="[INSTALLDIR]vcredist_x64.exe"/>
<CustomAction   Id='VCInstall'
                BinaryKey="MyVC"
                ExeCommand='/quiet'
                Execute='deferred' 
                Return='ignore'/>

<InstallExecuteSequence>
    <Custom Action="VCInstall" Before="InstallFinalize" ></Custom>
</InstallExecuteSequence>

如果不想使用引导程序,最好的方法是通过合并模块。要执行所需操作,必须使用自定义操作从二进制文件提取数据,并将其写入目标计算机上某个位置的新文件,然后运行安装程序-这不符合MSI最佳做法。不过,如果你想走这条路,我可以帮你。这就是我如何将它们添加到我的项目中,并在
InstallExecuteSequence

    <!-- Including the 64-bit redistributables if the platform is 64-bit -->
<?if $(var.Platform) = x64 ?>
<DirectoryRef Id="TARGETDIR">
  <Merge Id="Microsoft_VC110_CRT_x64" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_CRT_x64.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_ATL_x64" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_ATL_x64.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_MFC_x64" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_MFC_x64.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_MFCLOC_x64" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_MFCLOC_x64.msm" Language="0" DiskId="1"/>
</DirectoryRef>

<Feature Id="VCRedistx64" Display="hidden" Level="1">
  <MergeRef Id="Microsoft_VC110_CRT_x64"/>
  <MergeRef Id="Microsoft_VC110_ATL_x64"/>
  <MergeRef Id="Microsoft_VC110_MFC_x64"/>
  <MergeRef Id="Microsoft_VC110_MFCLOC_x64"/>
</Feature>
<?endif ?>

<!--Installing 32-bit Visual C++ 2012 Redistributables-->
<?if $(var.Platform) = x86 ?>
<DirectoryRef Id="TARGETDIR">
  <Merge Id="Microsoft_VC110_CRT_x86" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_CRT_x86.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_ATL_x86" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_ATL_x86.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_MFC_x86" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_MFC_x86.msm" Language="0" DiskId="1"/>
  <Merge Id="Microsoft_VC110_MFCLOC_x86" SourceFile="C:\Program Files (x86)\Common Files\Merge Modules\Microsoft_VC110_MFCLOC_x86.msm" Language="0" DiskId="1"/>
</DirectoryRef>

<Feature Id="VCRedist" Display="hidden" Level="1">
  <MergeRef Id="Microsoft_VC110_CRT_x86"/>
  <MergeRef Id="Microsoft_VC110_ATL_x86"/>
  <MergeRef Id="Microsoft_VC110_MFC_x86"/>
  <MergeRef Id="Microsoft_VC110_MFCLOC_x86"/>
</Feature>
<?endif ?>

这是一个完整的Qt5应用程序,其中包括VC可再发行文件作为合并模块,这可能提供了一个良好的起点。

vcredist是一个自解压MSI。WindowsInstaller互斥锁将阻止您从MSI中安装MSI。在安装之前使用Burn运行VC安装是更好的解决方案。