'WiX Bootstrapper with custom WPF UI, canceling a single package from a bundle

I have a wix bootstrapper project with multiple packages setup through bootstrapper bundle, and I'm having hard time to cancel a single package from the bundle. I use a custom WPF UI for my installer, and my goal is to do this job from my installer where I implement all bootstrapper events.

Setting up the e.Result = Result.Cancel in any event (e.g. in events like ExecuteProgress, ExecutePackageBegin, ExecutePackageComplete, DetectPackageBegin or DetectPackageComplete) doesn't do any good.

While e.Result = Result.Cancel assignment in ExecuteProgress event cancels/rolls back the whole installation, this same setup does in fact cancel/rollback the whole installation in the package level events too (e.g. in events like: ExecutePackageBegin, ExecutePackageComplete, DetectPackageBegin or DetectPackageComplete).

Is there any solution for this?

Again, my goal is to cancel a single (or few) packages arbitrarily, ignoring any rules setup in the bundle, using bootstrapper events in custom UI.

(I'm using Wix 3.14 and Visual Studio 2019 with Wix extension)

Thanks in advance



Solution 1:[1]

The bundle is designed to support rollback so that if anything goes wrong during execution, the machine is put back to the previous state as if nothing happened. The bundle is supposed to be a collection of packages that need to be installed and uninstalled together. What the BootstrapperApplication is supposed to do is determine which packages it wants installed during Plan, and only request the packages that it wants installed (OnPlanPackageBegin). It can't change the plan during Apply.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sean Hall