PDA

View Full Version : How to Rollback or uninstall from OnFirstUIAfter event?



Alex_W
07-05-2007, 11:41 AM
Hi All

Project Type: InstallScript MSI
History: I’ve installed SQLExpress & dropped database files.

In the OnFirstUIAfter event I am attaching the database files that were just installed, also I'm adding a database user to the system and granting access rights to that user.

My questions are:
1) Is the OnFirstUIAfter event the best place to do this?
2) If something goes horribly wrong and the user wants to abort and start all over then what's the best way to do this? ( I can’t use Abort() because about doesn’t initiate a rollback in the OnFirstUIAfter event. )

bryanwolf
07-06-2007, 02:18 PM
OnFirstUiAfter occurs after the execute sequence finishes and cannot be rolled back.

You probably want to pre-install SQL Express and then have your install make the necessary changes using the SQL Scripts view.

Alex_W
07-06-2007, 04:04 PM
Its really more a question of after I install SQLExpress as a prerequisit where is the best place to attach a database and add a database user? Since I have to copy the application and database files to the target PC, what's the first event I can use to try to that database stuff and can I recover from it or abort the whole install if need be.

bryanwolf
07-09-2007, 08:41 AM
My best suggestion is to use the built-in SQL Scripts view, which takes care of all of this during the deferred sequence and provides rollback functionality (http://helpnet.macrovision.com/Robo/BIN/Robo.dll?tpc=/robo/projects/installshield14helplib/SQLServer.htm).

If you want to roll your own, though, you would definitely want to make sure you're running all your custom actions as deferred custom actions. Otherwise, you won't have any rollback support.