Uninstalling Prerequisites Upon Installation Failure - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Uninstalling Prerequisites Upon Installation Failure

I have an installation that installs SQL Express as a Feature-Based prerequisite. It is installed based on a user selected option. This part of the installation works fine. What does not work is that if, for some reason, either SQL installation fails (I have a separate C# custom action that is called and parses the SQL install log looking for errors) or another part of the installer either a complete or partially finished install of SQL is left on the machine in the end.

How can I execute some actions after a failed installation to "clean up" after the install?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Uninstalling Prerequisites Upon Installation Failure

Hi,

In order to achieve what you want you can run your custom actions during rollback. For this you must check the "During installation rollback" radio button from the "Execution Time" group of your custom action.

Also, in the "Properties" tab of your SQL Express prerequisite you must uncheck the "Continue with main installation even if the prerequisite is not installed" checkbox.

Let us know if it helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Re: Uninstalling Prerequisites Upon Installation Failure

I am not selecting SQL 2008 R2 prerequisite from the list of canned prerequisites. I added it as a Feature to the main installation because not all users will need it as a prerequisite - only those who are installing the "Full" version of our software will. So I guess the more specific question is:

How do I uninstall something that was installed as a Feature (not the main application) when the install fails?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Uninstalling Prerequisites Upon Installation Failure

Hi,

In order to achieve what you want, you can add SQL Express as a Feature-Based prerequisite (the users will still be able to choose if they want to install it or not from the "ConfigureDlg" dialog).

In the "Setup Files" tab of the prerequisite, in the "Save return value in this property" text field write the name of a property created by you in the Install Parameters page (i.e. MYPROP).

In the Custom Actions page add your custom action above "Install Execution Stage -> Finish Execution" action group and use "MYPROP" property as a condition for its execution (for this you must know the return value of the prerequisite application in case of success or fail).

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Re: Uninstalling Prerequisites Upon Installation Failure

Thank you for your replies! I got this feature working but have one more question:

I include the SQL install .exe files as part of the Feature Prerequisite configuration. When I created my Custom Action with Sequence I also had to select an .exe file that would run attached. It appears that the SQL install executables (both 32 and 64-bit) are being added twice - once for the declaration in the Feature Prerequisite and once for the Custom Action that handles the uninstall.

Is there a way to get it so the install .exe's are only added once?
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Uninstalling Prerequisites Upon Installation Failure

Hi,

As you said, the package is added once for the prerequisite and once for the custom action, because Advanced Installer does not check to see if the prerequisite package and the custom action package is actually the same.

Unfortunately we don't have a workaround for this.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

Re: Uninstalling Prerequisites Upon Installation Failure

I have attached my .aip file for you to look at.
setup.aip
(180.62 KiB) Downloaded 451 times
I added two custom actions, one to uninstall the x86 version of SQL and the other to uninstall the x64 version. Each custom action uses the VersionNT64 environment variable and the SQL Installer return value to determine if it should uninstall. However, if I select "During Installation Rollback" for Execution Time it never runs. If there is a SQL error the installation will roll back but the correct uninstaller is not kicked off.

If I set it to "Immediately" it will uninstall properly and then the installer will quit. Am I doing something wrong?

Thanks!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Uninstalling Prerequisites Upon Installation Failure

Hi,

Please try to modify only the following settings:
- move your "UninstallSQL2008R2x86" and "UninstallSQL2008R2x64" custom actions below "Preparing" action group and test the project
- if it doesn't work with the first change, go in the "Properties" tab of your prerequisite and uncheck the "Continue with main installation even if the prerequisite is not installed" option, as I mentioned in my previous post (but also let the first change as I said above) and test the project again

Let us know if it helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”