Reputation: 1111
I'm trying to make the installer I'm writing install the Visual C++ 2012 package so the end user won't have to do it separately.
The executable is sitting in the installation directory but when I build my installer I get an error stating that the system cannot find the file.
Here is the chunk of code pertaining to the portion of my installer in question. Sorry in advance if there are multiple mistakes. I'm just starting to get my feet wet with 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>
Upvotes: 0
Views: 1624
Reputation: 2299
Here is a complete example installer for a Qt5 application that includes the VC redistributables as a merge module, which might provide a good starting point.
Upvotes: 0
Reputation: 3797
The best way to do this is through merge modules if you don't want to use a bootstrapper. For you to do what you want you would have to extract the data from the binary file using a custom action and write it to a new file in a location on the target machine and then run the setup - this does not follow MSI Best Practices. However if you want to go down this route I can help you. This is how I add them to my project and they get installed during the 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 ?>
Upvotes: 1