WIX runs vcredist_x64.exe during installation

I have an application compiled in VS 2015 and requiring VC ++ Redistributable to work properly. Prior to this last build, we used an older version of VS and simply used the merge module to process the corresponding redistribution files. However, I noticed that when using the latest merge modules for 2015 (Microsoft_VC140_CRT_x64.msm) my application still does not work out of the box. I did a few digging , and it seems that some things have changed with the latest merge modules. It seems that now Microsoft recommends installing the vcredist_x64.exe package directly instead of using merge modules.

So, I'm trying to create a custom action for this. I follow a similar tutorial here , although I adapt it for the VC Redistributable executable. The first thing I need to do is install where the .exe file will be installed after installation:

<Directory Id='APPLICATIONROOTDIRECTORY' Name='MyApp'> <Directory Id="VCREDISTDIR" Name="VCRedist"> </Directory> </Directory> 

Then I need to add my files to the component group, which will be installed as part of a hidden function (since I want it to be automatically installed).

 <ComponentGroup Id="VCRedist" Directory="VCREDISTDIR"> <Component Id="vcredist_x64.exe" Guid="-INSERT-GUID-HERE-" Win64="yes"> <File Id="VCREDISEXE" Name="vcredist_x64.exe" KeyPath="yes" Source="$(var.VCRedistSourceDir)" Checksum="yes"></File> </Component> </ComponentGroup> 

A...

 <Feature Id="VCRedistributable" Title="Visual C++ Runtime" AllowAdvertise="no" Display="hidden" Level="1"> <ComponentGroupRef Id="VCRedist" /> </Feature> 

At this point, the vcredist_x64.exe file should be copied to the destination computer. Now I need to create a custom action to run the executable after installation.

 <CustomAction Id="InstallVCRedistributable" FileKey="VCREDISEXE" Execute="deferred" ExeCommand="/silent" Impersonate="no" Return="check"/> <InstallExecuteSequence> <Custom Action="InstallVCRedistributable" Before="InstallFinalize"> <![CDATA[NOT REMOVE]]> </Custom> </InstallExecuteSequence> 

I also include a status message in my user interface so that I can see when the executable is executing.

 <UI> <ProgressText Action="InstallVCRedistributable">Installing Visual C++ Redistributable for Visual Studio 2015</ProgressText> </UI> 

Now, when I run my installer, it should run vcredist_x64.exe ... and it does it ... but then it hangs during the installation of this executable file. I get a pop-up message stating that the problem is with this Windows Installer package and that the program that is being executed as part of the installation has not been completed. Then it rolls back my main installation of the application and never installs. Can someone explain why this is happening and how to fix it? Thanks!

+6
source share
2 answers

I found this question and tried it myself, being in the same situation. I found that the installer error you are working on was / is Error 1618: "Another installation is already in progress." It seems that running the vc_redist installer inside your own installer will simply not work.

Your other options seem to be created by the bootloader, as Patrick Alwood suggests, or simply ask users to install the vc_redist package themselves before running their own installer. You may find that C universal runtime already exists by checking ucrtbase.dll in C:\Windows\System32 :

 <Property Id="UCRTINSTALLED"> <DirectorySearch Id="UCRTSystemSearch" Path="[WindowsFolder]System32" Depth="0"> <FileSearch Id="UCRTFileSearch" Name="ucrtbase.dll" MinVersion="10.0.10240.16389" /> </DirectorySearch> </Property> 

If you only have a 32-bit installer, you can also directly use the [SystemFolder] property.

EDIT: As Kevin Smith said, the ucrtbase.dll version gives strange problems - version 2.X for some tools and version 10.Y for other tools are reported. You can remove the MinVersion property if you just want to check for ucrtbase.dll .

+5
source

I think the right approach to having the prerequisites, which have their own installers, is to create a WiX download package that goes through each installer in turn. This handles things like rollbacks during installation failures, etc., which do not perform user actions inside the installer.

You can see the barebone sample here , you add <MsiPackage> and <ExePackage> to the Chain element in the order in which you need to install them.

+3
source

All Articles