Cleanup Bundle After Quit
As a Setup developer I can create a bundle such that the default behavior is to uninstall the bundle when no non-permanent packages are installed.
As a WiX developer I can provide a bootstrapper/chainer such that system administrators can trust that it will not leave traces on the machine once uninstalled.
The most common scenario is for bundles with a managed BA, where the prereq BA installs .NET and then has to reboot in order to load the MBA. See WIP 4822 for why the ARP entry is required.
During Plan, Burn needs to pay attention to whether any non-permanent packages will be present at the end. If not, then the ARP entry should be removed and the bundle uncached on success.
During Plan, Burn needs to pay attention to whether any non-permanent packages are already present. If not, then the ARP entry should be removed and the bundle uncached on failure (given that there are still no non-permanent packages present).
The package is considered present if it is installed or cached.
After the BA has called
BOOTSTRAPPER_SHUTDOWN_ACTION_NONEand been unloaded, Burn will try to see if the bundle should be uninstalled:
Applywas never called (1 and 2 above should have taken care of it already) and
- The bundle is installed and
- The bundle is per-user or has already elevated and
- There are no non-permanent packages installed and
- No related bundles that would run during
There are some caveats:
- It will run
Detectif it hasn't already happened.
Detectwill reset the condition on whether
Applyhas been called.
Applywith some of the special actions like
Layoutwill be treated as if it had never been called because it wouldn't have had a chance to remove the registration.
If it should be uninstalled, then it will go through
Since the BA has shutdown, all of this is done without interaction with the BA.
To allow the BA to opt out of this behavior, add a new
// Opts out of the engine behavior of trying to uninstall itself
// when no non-permanent packages are installed.
To allow the BA to know whether this will happen, add
fEligibleForCleanup as a parameter to
// Indicates whether the engine will uninstall the bundle if shutdown without running Apply.
The BA will no longer be able to cancel from
To allow the BA to stay installed despite not having any non-permanent packages present, add
fKeepRegistration (read-only for the BA) and
fForceKeepRegistration (writable by the BA) to
// Indicates whether the engine will uninstall the bundle.
// If fKeepRegistration is FALSE, then this can be set to TRUE to make the engine keep the bundle installed.
Some bundles may want to stay installed despite not having any non-permanent packages present.
This is considered an advanced scenario where the BA will need to use
BOOTSTRAPPER_SHUTDOWN_ACTION_SKIP_CLEANUP if it wants to stay installed.