我有一个使用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的副本