Reputation: 4015
I have a product that runs a service And if an msi upgrade starts Which first turns off the service So it can be replaced Then if the user manually cancels the upgrade from the MSI Or it rolls back on its own due to a failure Then is it possible to turn the service back on from the MSI?
Upvotes: 0
Views: 39
Reputation: 20800
If the upgrade's RemoveExistingProducts action is inside the transaction between InstallInitialize and InstallFinalize then it should all just work. For example, if you have the REP action immediately after InstallInitialize, then that old product gets removed and then the new product installs. If the install of the new product fails or is canceled then that REP also rolls back and reinstalls the old product. In the case of services, that means it will start the old service if that's what the install of the older product does. So if you're starting/stopping services with the standard MSI actions there shouldn't be a problem.
There are all kinds of assumptions here because, for example, your old install and new upgrade might be full of custom actions that don't have rollback equivalents, or install CAs that don't work for some reason when the older product is installed from a rollback, or services that don't shut down properly etc. A specific problem you may see would need a log to investigate.
If the user cancels during the uninstall of the old version, it's the same thing. There's still a transaction that rolls back and re-installs that old product and fails the upgrade. That will restart the service if that's what the install does. There's all kinds of ways in which this could fail too, such as CAs that don't do rollback, or an install that assumes the UI is always run. So it all just works if you let it.
Upvotes: 1