0

I have an installer made using WiX, that includes and executes the VC 2019 redistributable installer. My application depends on VC 2015, VC 2017 and VC 2019 due to several 3rd-party binaries.

I'm installing the redistributable using the /install /passive /norestart parameters, and it's done after the rest of files are copied.

My issue is that the application (the one installed) fails to start because it cannot find the msvcr140.dll is missing (as well as other 2015's runtime files).

If I then manually launch the VC redistributable (from command line) using exactly the same parameters, then the application starts correctly.

I'm elevating the installer on launch and I can see the vcredist is launched after my MSI finished copying files. Am I missing something

Note: I haven't trying the Merge modules yet, but I'm curious about why is the vcredist installer not working.

A simplified version of my WXI file is:

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

Update: the vcredist_142_x86.exe I mention in the above file is a copy of https://aka.ms/vs/16/release/vc_redist.x86.exe

cbuchart
  • 10,847
  • 9
  • 53
  • 93
  • Don't run installers like that via custom actions. Use a [Burn bundle](https://stackoverflow.com/a/52071758/129130) to launch the runtime first and then launch your MSI. Burn is a WiX feature to create setup.exe launchers instead of just MSI files. [One more sample](https://stackoverflow.com/a/18275683/129130). If you insist on not using Burn, try the merge modules to install the runtime. [Be aware of recent limitations here](https://stackoverflow.com/a/34597936/129130). – Stein Åsmul Sep 17 '20 at 15:33
  • I remember [this question / answer sequence](https://stackoverflow.com/a/51423249/129130) where the guy discovered he had forgotten to include `Microsoft_VC110_MFC_x64.msm`. See his comment at the bottom of my answer. – Stein Åsmul Sep 17 '20 at 15:43
  • [The latest supported Visual C++ downloads](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads). – Stein Åsmul Sep 17 '20 at 15:51
  • @SteinÅsmul thanks a lot for your guidance. Once I realize I cannot launch an installer from within another one, I tried several approaches, being a variation of [this one](https://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html) the best for me. – cbuchart Sep 18 '20 at 13:21

0 Answers0