0

我有一个使用 WiX 制作的安装程序,其中包含并执行 VC 2019 可再发行安装程序。由于多个第三方二进制文件,我的应用程序依赖于 VC 2015、VC 2017 和 VC 2019。

我正在使用/install /passive /norestart参数安装可再发行组件,并且在复制其余文件后完成。

我的问题是应用程序(安装的那个)无法启动,因为它找不到 msvcr140.dll 丢失(以及其他 2015 的运行时文件)。

如果我随后使用完全相同的参数手动启动 VC 可再发行组件(从命令行),那么应用程序将正确启动。

我在启动时提升了安装程序,我可以看到 vcredist 在我的 MSI 完成复制文件后启动。我错过了什么吗

注意:我还没有尝试过 Merge 模块,但我很好奇为什么 vcredist 安装程序不起作用。

我的 WXI 文件的简化版本是:

<Property Id="WIXUI_INSTALLDIR" Value="DIR_APPLICATION" />

<!-- Directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
  <!-- Main installation -->
  <Directory Id="ProgramFilesFolder">
    <Directory Id="DIR_COMPANY" Name="CompanyName">
      <Directory Id="DIR_APPLICATION" Name="TheProduct">
        <Directory Id="DIR_INSTALLATION" Name="vcredists">
          <Component Id="VCREDISTRIBUTABLE_142" Guid="*">
            <File Id="FILE_VCREDISTRIBUTABLE_142_EXE" Name="vcredist_142_x86.exe" Source="..\VC_redistributables\v142\vcredist_x86.exe" />
          </Component>
        </Directory>
      </Directory>
    </Directory>
  </Directory>
</Directory>

<Feature Id="FEATURE_PRODUCT" Title="PRODUCT" Level="1">
  <ComponentGroupRef Id="PRODUCT_FILES" />
  <ComponentRef Id="VCREDISTRIBUTABLE_142" />
</Feature>

<CustomAction Id="INSTALL_VCREDISTRIBUTABLE_142" Directory="DIR_INSTALLATION" ExeCommand='"[DIR_INSTALLATION]vcredist_142_x86.exe" /install /passive /norestart' Execute="deferred" Impersonate="no" Return="ignore" />

<InstallExecuteSequence>
  <Custom Action="INSTALL_VCREDISTRIBUTABLE_142" After="InstallFiles"><![CDATA[NOT Installed]]></Custom>
</InstallExecuteSequence>

<UI Id="UI_Main">
  <ProgressText Action="INSTALL_VCREDISTRIBUTABLE_142">Installing Visual C++ redistributables</ProgressText>

  <UIRef Id="WixUI_InstallDir" />
  <Publish Dialog="WelcomeDlg"
           Control="Next"
           Event="NewDialog"
           Value="InstallDirDlg"
           Order="2">1</Publish>
  <Publish Dialog="InstallDirDlg"
           Control="Back"
           Event="NewDialog"
           Value="WelcomeDlg"
           Order="2">1</Publish>
  <UIRef Id="WixUI_ErrorProgressText" />
</UI>

更新:vcredist_142_x86.exe我在上述文件中提到的是https://aka.ms/vs/16/release/vc_redist.x86.exe的副本

4

0 回答 0