NGambit
NGambit

Reputation: 1181

RemoveExistingProducts and InstallExecute action

I came across the following suggestion in this book,

If you schedule RemoveExistingProducts after InstallInitialize, you must also schedule the InstallExecute action to run after it.

This is in the context of a Major upgrade. But the author doesn't elaborate why one must do this. What is the reasoning behind it?

Upvotes: 0

Views: 1791

Answers (1)

PhilDW
PhilDW

Reputation: 20780

The MSDN docs for RemoveExistingProducts say that's what you must do, so that's one reason. It points out that the usual sequence with InstallExecute is InstallExecute, RemoveExistingProducts, and InstallFinalize. Otherwise REP needs to happen before there are any actual changes to the system, which is why immediately after InstallInitialize or InstallValidate are legal sequence choices, that's the more obscure rule about "before script actions that alter the system".

The other reason is that InstallExecute makes sure that the install transaction is complete, so you're not uninstalling the old product when the newly installed upgrade isn't fully complete and REP is before InstallFinalize.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa369502(v=vs.85).aspx

So in summary, REP needs to be sequenced before anything is done to the system or after all the required changes have been committed with InstallExecute if it's in the transaction. Also, if it's inside the transaction then it's included in the rollback which will reinstall the older product being upgraded. REP after InstallFinalize means that the uninstall can fail and roll back, reinstalling the product resulting in old and new products on the system.

The documentation you quoted saying"after InstallInitialize" does not adequately cover all the possibilities, because after InstallFinalize does not mean that InstallExecute is required. It may have been taken out of context but the MSDN docs are fairly complete.

Upvotes: 1

Related Questions