How do I set up my Wix installer to rollback all installed packages after mid-install restart

Viewed 47

I have a WiX 3.11-based installer with a managed bootstrapper application. One of the packages in the installer chain could trigger a restart. In my MBA, I handle the resume-from-restart behavior in the PlanPackageBegin event handler, inspired by the standard bootstrapper app:

private void Bootstrapper_PlanPackageBegin(object sender, PlanPackageBeginEventArgs e)
{
    // _bootstrapper.Status.ForcedRestartPackage comes from the WixBundleForcedRestartPackage engine variable
    if (_bootstrapper.Status.ForcedRestartPackage != null)
    {
        // Resuming after forced restart
        // Skip packages until after the package that forced the restart
        e.State = RequestState.None;
        if (e.PackageId == _bootstrapper.Status.ForcedRestartPackage)
        {
            _bootstrapper.Status.ForcedRestartPackage = null;
        }
    }
    else
    {
        ...
    }
}

My problem is, if the installer fails to install a package after the restart, it will only rollback the packages that were installed after the restart. If the install fails and starting rolling back, I want it to rollback all installed packages, even ones before the restart. Is there a way that I can configure my bundle or MBA to do this?

1 Answers

There's no way to do this today. The BA has pretty much no control over rollback behavior.

If you're trying to install and want to completely uninstall after the failure, then the BA can choose to uninstall if the user wants to close the installer instead of trying again.

Related