8

in a wix burn bootstrapper bundle: how to detect whether ms vcredist 2013 x86 is present or not?
i'm doing a check for the Upgrade Id / UpgradeCode of that particular package, but the bundle always installs it afresh, even though it is installed already.

...
<Bundle>
    ...
    <Chain>
        <!-- redist packages -->
        <PackageGroupRef Id="redist"/>
        ...
    </Chain>
</Bundle>

<Fragment>
    <PackageGroup Id="redist">
        <PackageGroupRef Id="redist_vc120" />
        ...
    </PackageGroup>
</Fragment>

<Fragment>
    <!-- vcredist 2013 x86 -->
    <?define vcredist2013minversion="12.0.21005"?>
    <Upgrade Id="B59F5BF1-67C8-3802-8E59-2CE551A39FC5">
        <UpgradeVersion Minimum="$(var.vcredist2013minversion)" Property="VCREDIST2013INSTALLED" OnlyDetect="yes" IncludeMinimum="yes" />
    </Upgrade>

    <PackageGroup Id="redist_vc120">
        <ExePackage Id="vc120" Cache="yes" PerMachine="yes" Permanent="yes" Vital="yes" Compressed="yes"
            Name="redist\VC120_Runtime\vcredist_x86.exe"
            InstallCommand="/quiet /norestart"
            InstallCondition="Not VCREDIST2013INSTALLED"
        />
    </PackageGroup>
</Fragment>
...

is there anything wrong with the InstallCondition?
or do i need to add a DetectCondition?

in the log file it reads:

Detected related package: {13A4EE12-23EA-3371-91EE-EFB36DDFFF3E}, scope: PerMachine, version: 12.0.21005.0, language: 0 operation: MajorUpgrade
Detected package: vc120, state: Absent, cached: None
Condition 'Not VCREDIST2013INSTALLED' evaluates to true.
Planned package: vc120, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: None, cache: Yes, uncache: No, dependency: None
Applying execute package: vc120, action: Install, path: <path and command line>...
Applied execute package: vc120, result: 0x0, restart: None

but also removing the InstallCondition and replacing it with the following DetectCondition did not work:

<PackageGroup Id="redist_vc120">
    <ExePackage Id="vc120" Cache="yes" PerMachine="yes" Permanent="yes" Vital="yes" Compressed="yes"
        Name="redist\VC120_Runtime\vcredist_x86.exe"
        InstallCommand="/quiet /norestart"
        DetectCondition="VCREDIST2013INSTALLED"
    />
</PackageGroup>

--

edit:
just to explain further: i'm trying the approach with UpgradeCode because i don't want to check for a particular installation package but for a minimum version.

Opmet
  • 1,754
  • 18
  • 20

2 Answers2

19

the following logic works fine for the bootstrapper bundle (burn):

<Fragment>
    <!-- vcredist 2013 x86 -->
    <util:ProductSearch Id="VCREDIST_120_x86"
        UpgradeCode="B59F5BF1-67C8-3802-8E59-2CE551A39FC5"
        Result="version"
        Variable="VCREDIST_120_x86" />

    <PackageGroup Id="redist_vc120">
        <ExePackage Id="vc120" Cache="yes" PerMachine="yes" Permanent="yes" Vital="yes" Compressed="yes"
            SourceFile="redist\VC120_Runtime\vcredist_x86.exe"
            InstallCommand="/quiet /norestart"
            DetectCondition="(VCREDIST_120_x86 &gt;= v12.0.21005)" />
    </PackageGroup>
</Fragment>

to summarize:

  • for search it uses util:ProductSearch with UpgradeCode parameter.
  • for detection it does a version comparison in the DetectCondition.

in burn the product detection based on the UpgradeCode obviously works different than in msi (where we can use the upgrade table along with attribute "OnlyDetect" and then configure a "LaunchCondition").


just for reference:
i found the following UpgradeCodes (along with their minimum version) to match ...

x86:

vcredist 2005 x86 - 86C9D5AA-F00C-4921-B3F2-C60AF92E2844, 8.0.61001
vcredist 2008 x86 - DE2C306F-A067-38EF-B86C-03DE4B0312F9, 9.0.30729.6161
vcredist 2010 x86 - 1F4F1D2A-D9DA-32CF-9909-48485DA06DD5, 10.0.40219
vcredist 2012 x86 - 4121ED58-4BD9-3E7B-A8B5-9F8BAAE045B7, 11.0.61030
vcredist 2013 x86 - B59F5BF1-67C8-3802-8E59-2CE551A39FC5, 12.0.40660
vcredist 2015 x86 - 65E5BD06-6392-3027-8C26-853107D3CF1A, 14.0.23506
vcredist 2017 x86 - 65E5BD06-6392-3027-8C26-853107D3CF1A, 14.15.26706
vcredist 2019 x86 - 65E5BD06-6392-3027-8C26-853107D3CF1A, 14.20.27508

x64:

vcredist 2005 x64 - A8D19029-8E5C-4E22-8011-48070F9E796E, 8.0.61000
vcredist 2008 x64 - FDA45DDF-8E17-336F-A3ED-356B7B7C688A, 9.0.30729.6161
vcredist 2010 x64 - 5B75F761-BAC8-33BC-A381-464DDDD813A3, 10.0.40219
vcredist 2012 x64 - EFA6AFA1-738E-3E00-8101-FD03B86B29D1, 11.0.61030
vcredist 2013 x64 - 20400CF0-DE7C-327E-9AE4-F0F38D9085F8, 12.0.40660
vcredist 2015 x64 - 36F68A90-239C-34DF-B58C-64B30153CE35, 14.0.23506
vcredist 2017 x64 - 36F68A90-239C-34DF-B58C-64B30153CE35, 14.15.26706
vcredist 2019 x64 - 36F68A90-239C-34DF-B58C-64B30153CE35, 14.20.27508

EDIT HISTORY:

1) updated the UpradeCode for vcredist 2017 x86 as per Brian Sutherland's comment. VS 2015, VS 2017 and VS 2019 all remain within the same family of 14.*.

2) added x64 variants to answer the question in Ahmed Daniel's comment. the updated listing mainly has been determined from running a modified version of the solution as suggested in answer https://stackoverflow.com/a/46637095
it's a shame that there's no official documentation by microsoft regarding those specific upgradecodes, but we just have to go and figure out ourselves ...

Opmet
  • 1,754
  • 18
  • 20
  • where did you get these upgrade codes? I want to get upgrade codes for x64 and dont know where to look. Thanks – zalimgandhera Nov 20 '17 at 14:11
  • 1
    The above codes didn't match what I found `vcredist 2015/2017 x86 - C146EF48-4D31-3C3D-A2C5-1E91AF8A0A9B` `vcredist 2015/2017 x64 - F899BAD3-98ED-308E-A905-56B5338963FF` vcredist is a bundle, has a main install and extended install msi, wondering if above id's are actually the sub installs? Using codes identified for 2015 in the same codes also worked for 2017 https://gist.github.com/nathancorvussolis/6852ba282647aeb0c5c00e742e28eb48 – Greg Domjan Dec 19 '17 at 11:30
  • 1
    @GregDomjan what you found are the Bundle UpgradeCodes. What is referenced at the end in Opmet's answer are the included vcredist minimum runtime msi UpgradeCodes. The bundles both include minimal and additional runtime msi installations. The codes you referenced are the upgrade codes you would use in a `` element in your wix burn bundle definition. – Brian Sutherland Apr 09 '18 at 16:46
  • 1
    Opmet has mistakenly referenced an upgrade code for vcredist 2015 and 2017. The 2015 x86 code (65E5...) is the vcredist minimal runtime msi upgrade code for both 2015 **and** 2017. The 2017 upgrade code (C78B...) is the vcredist additional runtime msi upgrade code for both 2015 **and** 2017. – Brian Sutherland Apr 09 '18 at 16:51
  • I think the UpgradeCode for VS 2008 is for SP1. Any clue as to the UpgradeCode for the no-SP 2008 ? – Denis Troller Aug 05 '19 at 09:38
  • Nevermind, I got it. UpgradeCode for base x86 2008 is AA783A14-A7A3-3D33-95F0-9A351D530011 and version is 9.0.21022 – Denis Troller Aug 05 '19 at 09:41
-1

I use registry serach to check if installed, try to do it as:

<util:RegistrySearch
  Root="HKLM"
  Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<Place Guid>"
  Value="DisplayVersion"
  Variable="MSVC_2013_x64"
  Win64="yes"/>

and the condition as:

DetectCondition="MSVC_2013_x64 AND (MSVC_2013_x64 &gt;= v12.0.21005)"
Arkady Sitnitsky
  • 1,846
  • 11
  • 22
  • this answer checks for the `ProductCode` of the redist package. hence it will fail to detect any later service pack release of the redist package. the original question ask how to use for `UpgradeCode`. – Opmet Mar 09 '16 at 06:37