cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
MATT031389
Pilgrim

Unable to initiate rollback during custom actions

I have a question regarding custom actions.

I have been toying with different methods of adding some extra functionality that is application dependent that we will require for some of our installers. We need to be able to prompt the user with some application specific options, as well as verify that our applications and services aren’t currently running so we can update the appropriate files. (Snap-In architecture)

The root of the problem that I am running into is the unfriendliness of the InstallShield messages I am getting when I am trying to cancel or rollback an installation.

When I use a Custom Action that is available to me and I try to return a non-zero exit code to tell Installshield that installation should stop and rollback, there is a very unfriendly message that appears (shown below)



When we are trying to rollback an installation it could be for many perfectly valid reasons. We definitely DO NOT want them to call support every time a rollback occurs. Is there any way to circumvent this dialog and still have the installation rollback?

I also looked at using an installer component class in a separate project and in the distribution files view check the “Installer” checkbox on the properties view of the project output. When I do this, it seems like the only way to get the installation to rollback is to either throw an exception myself, or call me.rollback() which seems to throw an exception anyway. Either way, what I end up with is TWO PROMPTS of the same unfriendly error that is shown below.



In both of these scenarios it is quite possible that they have some of our other services running and they do not want to stop them at the current point in time so they should be able to cancel the installation.

Is there any way to abort /rollback an installation based on some conditions and NOT receive these ugly messages? Any help on this would be appreciated.

Thank you,
0 Kudos
3 Replies
joshstechnij
Pilgrim

Re: Unable to initiate rollback during custom actions

To cause a install failure (and subsequent rollback) a custom action needs to be running as part of the installation script. Specifically, this means that the action is sequenced between the InstallInitialize and InstallFinalize standard actions and the In Script Execution setting is set to Deferred or Deferred in System Context (if elevated privileges are required for the action to run successfully). Failures returned from these actions will cause the installation to roll back from the point of failure.

Immediate custom actions cannot cause a rollback (since nothing is actually installing or the install has already been committed when they run) and can cause an error dialog to appear.

The MSDN documentation on custom actions provides the most complete information on how Windows Installer custom actions can be authored and sequenced:
http://msdn.microsoft.com/en-us/library/aa368066(v=vs.85).aspx
0 Kudos
MATT031389
Pilgrim

Re: Unable to initiate rollback during custom actions

So essentially you are telling me that there is no way to do this in InsatllShield Limited Edition as the "InstallScript" node is locked for that version?
0 Kudos
joshstechnij
Pilgrim

Re: Unable to initiate rollback during custom actions

My previous post was referring to the In-Script Execution setting in the Custom Actions and Sequences view for Professional and Premier editions. This setting is present for EXE, MSI DLL, Standard DLL, VBScript, JScript, Managed Code, and InstallScript custom action types. The In-Script Execution setting is unrelated to InstallScript.

For Express or Limited editions of InstallShield, sequencing actions at the following locations in the Custom Actions view will turn them into deferred actions:
After File Transfer
After COM Registration
After Register Product

Note that these sequence points are later (no earlier than after files are installed) in the installation just before it is committed to a target machine. A failure at one of these points will cause the installation to roll back.

Please refer to the following MSDN article for information on the proper use of return values from custom actions:
Custom Action Return Values - http://msdn.microsoft.com/en-us/library/aa368072(v=vs.85).aspx
0 Kudos