简体   繁体   中英

Wix <MajorUpgrade> not working after bundling the VC redistributables

We recently decided to bundle the VC++ redistributable packages with our application. Unfortunately, this broke our upgrade.

The old product is not correctly uninstalled and is still present in the Add / Remove control panel together with the new version. If I understand it correctly, this happens when not all features of the old installer are uninstalled, that's why I tried the two approaches described below. If I do not bundle the VC redistributables, the old product does not show up in the control panel anymore.

What could be the reason for this behavior and how could I fix it?

Common code

<MajorUpgrade
    DowngradeErrorMessage="There is already a version of [ProductName] installed."
    Schedule="afterInstallExecute"
/>

<!-- include the Visual C++ Redistributable -->
<DirectoryRef Id="TARGETDIR">
    <?define MergeModulDir= "C:\Program Files (x86)\Common Files\Merge Modules" ?>
    <Merge Id="VCRedist86" SourceFile="$(var.MergeModulDir)/Microsoft_VC140_CRT_x86.msm"
           DiskId="1" Language="0" />
</DirectoryRef>

Version 1: additional feature

<Feature Id="VCRedist" Title="Visual C++ 14.0 Runtime" AllowAdvertise="no"
         Display="hidden" Level="1">
    <MergeRef Id="VCRedist86" />
</Feature>

<Feature Id="App" Title="Main Application" Level="1">
    <ComponentGroupRef Id="App" />
    <ComponentRef Id="ApplicationShortcut" />
    <ComponentRef Id="CleanRegistry" />
    <ComponentGroupRef Id="SendToShortcuts" />
</Feature>

Version 2: inside existing feature

<Feature Id="App" Title="Main Application" Level="1">
    <ComponentGroupRef Id="App" />
    <ComponentRef Id="ApplicationShortcut" />
    <ComponentRef Id="CleanRegistry" />
    <ComponentGroupRef Id="SendToShortcuts" />
    <MergeRef Id="VCRedist86" />
</Feature>

I'd do the upgrade with a verbose log to see what's going on. In particular look at the FindRelatedProduct occurrences (there will be several) that apply to your upgrade and see if there is anything there.

Here's my guess: Some C++ merge modules force a per system install. If the existing installed product is per user then the upgrade won't happen because it's cross context, leaving you with both old and installed. I don't know what you've seen when you mention "when not all features of the old installer are uninstalled" but the upgrade is an uninstall of the older product, so there is no reason for parts of it to get left behind. To be more specific, look in the Property table of the merge module to see if it has an ALLUSERS=1 entry.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM