Elist
Elist

Reputation: 5533

WiX - How to link an ExePackage element into a Product

I am trying to include the VC++ Redistributable 2013 prerequisites installation in my MSI installer.

I have modified the Fragment written by this guy to quietly download and install the vcredist_x86.exe package after performing a registry check (file - MyWixProject/vcredist.wixobj):

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <?define vcredist_x86="http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe"?>

    <Fragment>
        <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\DevDiv\vc\Servicing\12.0\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vc\Servicing\12.0\RuntimeMinimum" Value="Install" Variable="vcredist" />
        <PackageGroup Id="vcredist">
            <PackageGroupRef Id="InstallVCRedist"/>
            <ExePackage Id="vcredist_x86"
                        Cache="no"
                        Compressed="no"
                        PerMachine="yes"
                        Permanent="yes"
                        Vital="yes"
                        Name="Redist\vcredist_x86.exe"
                        SourceFile="Redist\vcredist_x86.exe"
                        DownloadUrl="$(var.vcredist_x86)"
                        InstallCommand="/q"
                        DetectCondition="vcredist AND (vcredist &gt;= 1)">
                <ExitCode Value ="3010" Behavior="forceReboot" />
            </ExePackage>
        </PackageGroup>
    </Fragment>
</Wix>

I am trying to reference this Fragment from my Product element (file MyWixProject/Product.wxs). I read that "The contents of a Fragment element can be linked into a product by utilizing one of the many *Ref elements". But how can a ExePackage or its PackageGroupRef be referenced from the main Product element? Or is there another way to compile the .wixobj and its Fragment from within the .wxs Product?>

Upvotes: 0

Views: 2468

Answers (1)

Bob Arnson
Bob Arnson

Reputation: 21886

ExePackage works only in a Bundle, not a Product. MSI doesn't support multiple Products installing at the same time and the VC++ redistributable is just a Bundle with multiple Products in it.

Upvotes: 2

Related Questions