问题
I have some custom actions in my installer. These are sequenced after InstallFinalize action.
I need to implement rollback for these custom actions.
As Far as i read, I can only implement rollback for custom actions sequenced between InstallInitialize and InstallFinalize.
Any way i can do it?
回答1:
As you say, rollback applies only to the transaction part of the installation, which is between InstallInitialize and InstallFinalize. That is the install transaction and there is no rollback outside these boundaries. If you do something after InstallFinalize that fails, it's too late - the install is over. As has been said, don't put your CA there if you want rollback.
回答2:
Any custom action that changes the system sequenced after InstallFinalize is by definition an error in design. I would also be careful with custom actions that show messages and inspect the system. They should NOT return error codes at least, or a full rollback of the install might occur - this is particularly unfortunate for major upgrade scenarios (may leave two versions of a product registered, but only one installed).
Custom actions after InstallFinalize always fail in some contex which you cannot predict - often when the package is deployed via deployment system such as SCCM (SMS) or similar. Generally the custom actions after InstallFinalize are skipped or trigger unexpected rollbacks of the entire installation. They will also fail consistently when run without full administrator rights.
What kind of registry operations are you performing? They should be easy to implement in other ways.
回答3:
If your immediate mode custom action add registry data, I would remove them all and convert the registry data to be added by the registry table. This table features built-in support for advanced rollback and merging of registry keys and values. I think this is what you are asking.
When you have a product "in the wild" like you seem to have, I would recommend that you run the major upgrade with RemoveExistingProducts early in the InstallExecuteSequence and then install your new version with all immediate mode "change actions" gone. This should provide a smooth upgrade scenario, but makes patching difficult.
来源:https://stackoverflow.com/questions/22583822/wix-installer-rollback-custom-action-for-a-custom-action-sequenced-after-instal