Does anyone know how to make InstallAware do a rollback of a database when the user clicks 'Cancel'? Unlike InstallShield I'm not seeing any way to specify when individual scripts run.
You sure this isn't just done auto-magically? InstallAware seems to do some funky things at times, and I wonder if they do what amounts to a rollback in some weird way.
I don't think InstallAware would be able to rollback a database transaction. I didn't see any intrinsic support for SQL Server rollbacks in their MS SQL Server command. You would need to code your own rollback script, if that is possible.
There is usually a section in the MSICode that has an IF block if the user cancels the installation during the initial dialogs. It looks something like this
if variable WIZARD Equals CANCEL
Terminate Installation
end
This occurs before the Windows Installer engine actually performs the installation. If you have not executed your database scripts, then no action is required. If you have applied database scripts before this point, you will need to supply a rollback script (if possible) and execute it in that block, but before Terminate Installation.
If you cancel the installation while install, you'll have another shot of rolling back your changes. When the user presses the cancel button while the installation process is running (i.e. after the user has made any selections), the InstallAware variable SUCCESS will be set to CANCEL. You can check for that condition and execute your rollback script. There is usually a block of code that does various things based on the value of SUCCESS, you can add your code there.
You could always make your SQL script the last command executed by InstallAware as part of the installation. That would eliminate the need to handle the cancellation.