简体   繁体   中英

WiX installer doesn't show uninstall dialog after rebuilding

I have an install and an uninstall dialog in my custom WiX 3.7 installer. This comes from my custom Bootstrapper Application. When my software is not installed and I start the installer, it shows the installation dialog. When it is installed and I start the installer, it shows the uninstall dialog (a custom dialog).

When I now rebuild the installer without changing anything in the WiX installer project and start the installer while the software is installed, it does not show the uninstall dialog anymore. Instead it shows the installation dialog.

The check whether the application is installed or not is made in the DetectBegin method of the Bootstrapper. However, when I click on install, it realizes it is already installed and aborts the process.

Why does this behavior happen? Does the Bootstrapper check if it is installed to decide which dialog to show? So does it think it is a different Bootstrapper, because it was rebuilt?

If so how can I make the Bootstrapper show the uninstall dialog when my application with the same version is already installed? Do I have to include some condition?

Without more info about your WiX/MSI and bundle settings there'll be some guesswork but:

The ProductCode in an MSI determines if the product is installed or not. There is no such thing as installing the same product(code) twice in the same context, such as per machine. It's already installed, by definition, therefore attempting to install it again causes it to go into maintenance mode, for which apparently the only choice is your uninstall dialog.

If you rebuild the MSI without changing anything it's not the same if you have Product Id="*" because that means that the ProductCode will change whenever you build, so there will be a new product and since it's not installed on the system you'll get an install dialog.

So I suspect that you need a MajorUpgrade element in your MSI so that your new MSI with incremented ProductVersion, same UpgradeCode and new files will upgrade the older product.

The bootstrapper works similarly, since it is the product package that wraps your MSI, so you'll probably need an incremented bundle version too, so that the MSI upgrades as well as the bundle infrastructure (which might own the Progreams&Features entry).

I found a solution. Apparently the Bundle ID is unique for every build and it is not possible to set it. That is why, when rebuilding, the Bootstrapper callback "DetectBegin" has its "Installed" property in "DetectBeginEventArgs" set to false. This is where I made the decision to show the install or uninstall dialog.

I now additionally use the "DetectRelatedBundle" callback. Here, the "Operation" property of the "DetectRelatedBundleEventArgs" is set to "RelatedOperation.None", if an application with same version, product code and upgrade code is installed.

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