Terminating MSI installation when prerequisite install fails - 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!

JStrauss
Posts: 5
Joined: Thu Dec 09, 2010 7:01 pm

Terminating MSI installation when prerequisite install fails

Hello, my team is experiencing some difficulty with the use of Prerequisites. We are deploying a Microsoft WPF application that requires the .NET Framework 3.5 SP1. One of our test users attempted to install the software on a clean Windows XP box that did not have the framework installed. In our Advanced Installer project, we have listed .NET 3.5 SP1 as a prerequisite product, to be pulled from the official Microsoft URL.

When this user attempted to launch installation, he received an error stating:
You must have administrative privileges to run the Microsoft .NET Framework 3.5 SP1 Setup. Please contact your system administrator.
That error message, I believe, came from the .NET installer, not our MSI file generated by Advanced Installer. And, no doubt, the error message is appropriate, as Admin privileges are required to install .NET. No problems here. However, the next screen the user sees is:
INSTALLER INFORMATION: Warning 4154. .NET Framework 3.5 SP1 prerequisite was not correctly installed. Continue installation of (product name)? Yes / No
If the user selected yes, installation of the main features in the package continued as set forth in the Advanced Installer package, and ultimately, the user receives an "installed successfully" message. The problem, of course, is that he then goes to launch the software and gets tons of errors and exceptions because the underlying .NET Framework and CLR runtime are not installed on his machine. This is a problem.

So my question: What settings are required to halt installation in the event a prerequisite installation fails? I don't want my user to have the option of continuing installation of the product if the prerequisite is not installed correctly. Rather, I'd prefer a message stating that installation cannot be completed until the .NET Framework is successfully installed.

Current Properties for my Prerequisite in Advanced Installer:
  • Properties
  • Location: URL
  • URL: http://download.microsoft.com/download/ ... 5setup.exe
  • Command Line: /q /norestart
  • [i][u]Options[/u][/i]
  • Force installation of this prerequisite (checked)
  • Feature-based prerequisite installs during main MSI install (selected)
  • Everything else unchecked
Any and all help will be greatly appreciated, as our clients are about ready to launch this commercial application, and they are very eager to put this issue to rest.

Thanks,
Jeff Strauss (JStrauss)
St. Louis, Missouri, USA
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Terminating MSI installation when prerequisite install fails

Hi Jeff,

The easiest approach is to make your prerequisite global and add a .NET Framework launch condition. This way the main installation stops if .NET is not installed.

If you want to use a feature-based prerequisite, you can try this approach:
- make sure you are using an Enterprise project
- create a custom action which determines if .NET is installed or not
- this custom action should return 0 if it's installed and 1602 if it's not installed
- schedule this custom action under "InstallUISequence" -> "ProgressDlg"
- in "Table Editor" page go to InstallUISequence table
- modify the sequence of your custom action to be right after AI_InstallPrerequisite

Since the custom action returns 1602 if it doesn't detect .NET, it can be only a Win32 DLL or a VBScript. This code stops the installation with a standard Windows Installer message.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
JStrauss
Posts: 5
Joined: Thu Dec 09, 2010 7:01 pm

Re: Terminating MSI installation when prerequisite install fails

Hi Cosmin,

Thanks for the feedback. So, if I make the prerequisite global and add the launch condition as you suggested, will the Advanced Installer project (my MSI) still attempt to install the .NET Framework if it is not found? Our goal is to ensure it is present, but we also want to attempt to install it if it's not. Really, the only time main installation should be stopped is if .NET is not present and the user performing the install does not the necessary Administrator privileges to install the framework.

Does that make sense?

Thanks,
Jeff
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Terminating MSI installation when prerequisite install fails

Hi Jeff,

Yes, the prerequisite is still installed when not found. When it's global it will be installed before the main installation, not during.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
JStrauss
Posts: 5
Joined: Thu Dec 09, 2010 7:01 pm

Re: Terminating MSI installation when prerequisite install fails

Ok, so currently, in addition to having a prerequisite, I also have the .NET Framework as a feature set on the Organization tab. It's set to always install, and does not display in the features tree during the setup type dialog, because it is mandatory. So I am assuming this means I should remove the Framework as a feature and leave it ONLY as a prerequisite and launch condition? Or do I still need to keep it listed in the Organization tab as a feature, as well?

Again, thanks for all the help!

-Jeff
JStrauss
Posts: 5
Joined: Thu Dec 09, 2010 7:01 pm

Re: Terminating MSI installation when prerequisite install fails

Aha! Never mind on that last question. Now that I have run through and done what you suggested, I see that Advanced Installer automatically removes the .NET Framework installation from its given feature in the Organization tab automatically. I got everything updated and have circulated to the client for testing to see if this fixes our problems. Will keep you posted if we have any additional questions or problems. Thanks!

-Jeff
JStrauss
Posts: 5
Joined: Thu Dec 09, 2010 7:01 pm

Re: Terminating MSI installation when prerequisite install fails

Cosmin-

Hello again. Now that we have moved to the next phase of user testing, we are still experiencing some problems. At first glance, everything is running OK. However, when we encountered another issue with a clean Windows XP install, where the .NET Framework is not present.

On the bright side, we are no longer getting the option to continue installation without the Framework installed, thanks to the inclusion of a software launch condition. However, our global prerequisite (.NET Framework 3.5 SP1) does not install even when it is not found. Instead, when I run the MSI, all that happens is it goes straight to the launch condition, determines it has failed, and terminates installation. There is no opportunity to actually install the Framework when the prerequisite wasn't already met. I haven't changed any settings changes to the prerequisite (other than your suggestion to make it global) since my initial post.

Please help! No idea where my problem lies. :(

-Jeff
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Terminating MSI installation when prerequisite install fails

Hello Jeff,

Have you tested the package on other clean machines as well?
Also, please make sure you have your INI file next to the EXE when installing it. This or from the "Media" page -> "Bootstrapper" tab make sure you have the "Include install files in EXE" option enabled.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”