cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

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
Active participant

Re: How to trigger error and abort installation from Installscript?

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

Re: How to trigger error and abort installation from Installscript?

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 Smiley Sad
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 Smiley Very Happy

Respect for ur help and guidance Smiley Happy

Thanks and bye.
0 Kudos
rguggisberg
Active participant

Re: How to trigger error and abort installation from Installscript?

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

Re: How to trigger error and abort installation from Installscript?

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