dogstar
Pilgrim

Please help: Rollback installation after moving data

Hi there,

I'm trying to make a installation package for a product. After moving data, I need to add some customized work and configurations. For example, creating a database, etc. So I create an Installscript MSI project. And I added my customized things in the event OnFirstUIAfter().

I'd like to rollback (or you can say Uninstall) the installation if my customized things failed (for example, error occurs when creating a database): All data which have been copied to disk should be removed. And all records of this product (in registry and other places) should be cleaned up too.

I tried to add some codes as below but seems they did not work. With debug mode, I saw every line is walked but nothing happened. Can anyone help me out? Thanks a lot!
if (createDB() < 0) then
// Uninstall the application
FeatureRemoveAll();
FeatureTransferData(MEDIA);
abort;
endif;
Labels (1)
0 Kudos
3 Replies
dogstar
Pilgrim

Re: Please help: Rollback installation after moving data

Does anyone have any suggestions? Thanks in advance.
0 Kudos
gridman
Pilgrim

Re: Please help: Rollback installation after moving data

I need to know about this for a similar situation. I know that you won't need the also call to FeatureTransferData.

Sometimes I have used FeatureRemoveAllInMediaAndLog when FeatureRemoveAll hasn't removed everything.

However, I would also like to know more about rollback.
0 Kudos
KathyMorey
Pilgrim

Re: Please help: Rollback installation after moving data

I think you're basic issue is going to be that, in an InstallScript MSI project, the OnFirstUIAfter event comes after the MSI portion of the installed is finished. That is, Windows Installer has been called and has installed the components and has closed the database.

You might be able to do what you want with a pure InstallScript project, or you might be able to do it with an MSI with custom actions (and associated rollback custom actions), but I don't think you're going to be successful trying to uninstall the MSI part of an InstallScript MSI project with InstallScript events.
0 Kudos