InstallShield Tips and Techniques

June 4, 2013

Setting up Rollback Custom Actions

Filed under: Reference Materials — shieldmaster @ 11:43 pm

Rollback Actions are triggered when the setup encounters an abort situation and the internal “Rollback” script is invoked. Without going into details of the Rollback script – essentially what the setup does to modify the workstation, the rollback script will undo. For example, any files installed will be removed; any shortcuts or registry entries added will also be removed.

But what if you have Custom Actions that serve to modify the workstation – these actions are not written into the internal InstallShield engine’s rollback script. When the setup encounters an abort situation and the rollback script is invoked, these modifications are not removed. In a worst case scenario, they might prevent the setup from being executed again.

The bottom line is – if you have Custom Actions that serve to modify the workstation during the setup, you should create the special “Rollback” Custom Actions that clean up those modifications.

These are some important issues that must be addressed when you create a Rollback Custom Action:

  • Set the Rollback Custom Action to be sequenced before any Deferred Custom Actions that modify the workstation
  • must be Deferred and sequenced after “InstallIntialize” and before “InstallFinalize”
  • Use In-Script Execution “Rollback Execution”
  • For testing, if you are using an InstallScript CA, you can issue a MessageBox to indicate it’s running when invoked

     

To test the Rollback Custom Action, you can create an InstallScript Custom Action, and set the following:

  • Calls simple InstallScript function “ISI_TestRollback”
  • Set as Deferred Execution
  • Sequence between “InstallIntialize” and before “InstallFinalize” and after the Rollback Custom Action
  • Within script just place “return -1” to trigger error routine

 

When the function ISI_TestRollback fails, the InstallScript rollback script is triggered and the Rollback Custom Action should be activated. Then the actions can be handled to clean up the modifications that would normally be left.

 

Hope this helps!

ShieldMaster

 

Advertisements

5 Comments »

  1. Spot on with this particular write-up, I actually think this site needs a great deal much more attention. I will most likely be returning to see more, thanks for your information!

    Comment by 行動電源 — July 1, 2013 @ 11:22 pm

  2. Excellent post, thanks for the info. This is certainly a good practice to include with any custom action developed.

    Additionally, I’d like to say that instead of pop-ing up Messageboxes that may get to the final installer, a good option is to log the messages to the MSI installer log, there are some examples around that show how to do it, the following code works for me.

    Function MSILogInfo(msg)
    Dim rec
    Set rec = Session.Installer.CreateRecord(1)
    rec.StringData(0) = msg
    LogInfo = Session.Message(&H04000000, rec)
    End Function

    Comment by Rafa M — July 16, 2013 @ 10:11 am

  3. Нello my friend! I want to ѕay that thi article is amazing, great
    written and come with approximately all
    important infos. I’d like to see more posts like this.

    Comment by Abigail — August 25, 2014 @ 6:24 pm

  4. Adding a “Standard DLL -> Stored in binary table” CA in an InstallShield 2015 Basic MSI project, I’m not seeing any Rollback execution option.

    Comment by Benjamin Marty — September 2, 2015 @ 2:28 pm

    • Only specific Custom Actions are eligible to be created as Rollback. The execution option indicates which are available. Since a Standard DLL does not have a Rollback option, it is possible the execution script can automatically handle any system modifications and can roll them back without Customized Actions.

      ShieldMaster

      Comment by shieldmaster — September 2, 2015 @ 11:07 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: