cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dinesh_redhawk
Level 6

How to trigger error and abort installation from Installscript?

Hello Guys,

I have to do error handling in my installer. One of the requirement is to abort the installation whenever any step fails in case of any error or exceptions. Additionally in some case trigger Rollback as well. Its a basic MSI project.

My current situation is, in case of any error conditions i will try to catch them in Catch block and want to trigger a dialog box with some custom error message and trigger abort or rollback based on the condition.

How can i accomplish this? I tried using "return ERROR_INSTALL_FAILURE;" but this is not triggering the error.

How to achieve it?

Please help. Its very important.
Labels (1)
0 Kudos
(4) Replies
rguggisberg
Level 13

Post a message withMessageBox and then abort. Note that "The abort statement does not call a rollback if initiated after the OnFirstUIAfter event."

MessageBox( szMsg, SEVERE );
abort;
0 Kudos
dinesh_redhawk
Level 6

rguggisberg wrote:
Post a message withMessageBox and then abort. Note that "The abort statement does not call a rollback if initiated after the OnFirstUIAfter event."

MessageBox( szMsg, SEVERE );
abort;


Hi rguggisberg,

Thanks for your response. This solution i know and quite simple way of handling. In my case its a suite installer, so dont have the privilege of using messagebox 😞
And moreover, i read abort statement will not work in windows OS 8.1 and above. This is official statement, however, fun fact is i tried abort in Win 10 and it works.

Can u post ur thoughts about using "return ERROR_INSTALL_FAILURE". that will be educational for me 😄

Respect for ur help and guidance 🙂

Thanks and bye.
0 Kudos
rguggisberg
Level 13

ok.. your original post said Basic MSI. For a suite project you can set a property in your CA that you can then use as a condition to display a Secondary window (see bottom of Wizard page). In a suite project you may already have some of the packages installed. You will have to do your own rollback behavior.
Hope that helps.
0 Kudos
dinesh_redhawk
Level 6

rguggisberg wrote:
ok.. your original post said Basic MSI. For a suite project you can set a property in your CA that you can then use as a condition to display a Secondary window (see bottom of Wizard page). In a suite project you may already have some of the packages installed. You will have to do your own rollback behavior.
Hope that helps.


Thanks man, i will try that...sorry for the confusion for Basic MSI thing...
0 Kudos