简体   繁体   中英

Cannot perform upgrade and uninstall with WiX installer

I have a simple installer and I want to be able to perform upgrades and do proper uninstalls without having to manually generate a new ID each time.

This is my code (the relevant parts):

<Product Id="*" UpgradeCode="$(var.UpgradeCode)" Name="$(var.ProductName)"
    Language="!(loc.Language)" Codepage='1252' Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)">

        <Package Id='*' Keywords='Installer' Description="My Installer" Manufacturer='$(var.Manufacturer)'
          InstallPrivileges='elevated' InstallScope='perMachine'
          InstallerVersion='200' Compressed='yes'/>

        <MajorUpgrade Schedule="afterInstallValidate"
                     DowngradeErrorMessage="A later version of [ProductName] is already installed"
                AllowSameVersionUpgrades="yes"
                AllowDowngrades="no" />
                
        <InstallUISequence>
            <Show Dialog="WelcomeDlg" After="CostFinalize" />
        </InstallUISequence>
</Product>

The problem is that I cannot seem to get upgrades and uninstalls to work with the same code/installer.

If I use Product Id="*", I'm able to perform upgrades, but when I try to uninstall, only the entry from Add/Remove Programs is removed. The installed files, however, remain in Program Files.

If I use Product Id="some random guid", I'm able to uninstall, but I'm no longer able to perform upgrades.

So my questions is:

Can I perform upgrades and uninstalls with a wildcard Id (ie Product Id="*"), or do I have to manually generate a new ID each time?

Thanks!

I used (Product Id="*") in my WiX installer and it is still able to perform upgrades and uninstalls. My code for Product, Package and Major Upgrade look almost identical to yours so I think the problem lies somewhere else.

Do you have this in your Product section to tell WiX which component groups to install/uninstall? (see code)

<Feature Id="ProductFeature" Title="[ProductName]" Level="1">
        <ComponentGroupRef Id="ComponentGroup1" />
        <ComponentRef Id="DesktopApplicationShortcut" />
</Feature>

Edit: I have since noticed one other thing that may help you out. I was recently having issues with my program not removing the Desktop Shortcut during Uninstall, despite it working in the past. I have since changed the Guid from "*" to a Guid code and it is now being removed. I think it is the program recognizing the Component.

<Component Id="DesktopApplicationShortcut" Guid="{Create Guid Code}">

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