WiX - restart service during upgrade rollback

16 views Asked by At

I have recently inherited a cross-platform application with a Wix 3 installer for the Windows version. We're working on releasing a new version, and nobody on the team is particularly strong with Wix. Most of us don't even use Windows. I mention this because it's fairly likely that I'm missing something that would be considered obvious or idiomatic.

Our application runs as a background Service.

In the old version, the installer used custom actions to install, start, and stop the service. As I learned more about Wix, I found that this was bad for several reasons, and now we're using ServiceInstaller and ServiceControl tags to accomplish the same.

I have one remaining custom action, called PostInstall, which performs some tests to ensure that the installation is healthy, and triggers a failure+rollback if anything goes wrong.

When PostInstall fails during a MajorUpgrade, rollback appears to succeed -- but the service remains and is running the new version. If I manually stop and start the service, it's back to the old version. Before that restart, I assume that the running service exists only in memory.

I expected that, by using ServiceControl, rollback would know what to do, but I have some concerns that since the previous Service was installed and controlled by custom actions, that it might only shut down the new service but wouldn't restart the old. But maybe that only applies to uninstall and has no bearing on the rollback script.

Important bits:

<ServiceControl Id="agentServiceControl" Name="agent" Start="install" Stop="uninstall" Wait="yes" />

MajorUpgrade.Schedule is set to afterInstallExecute.

What do I need to do to get MSI to restart the service during rollback?

0

There are 0 answers