Installation fails after enabling .NET on Win Server 2008 R2 - 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!

prolancer
Posts: 17
Joined: Wed Nov 23, 2011 6:16 am

Installation fails after enabling .NET on Win Server 2008 R2

Hi,

We created a package which we use to install our application on Win 2008 R2 server, 64 bit.

We defined MS SQL Server Express R2 x64 as a pre-requisite which will install as a feature. However, to install SQL Server, the .NET feature must be enabled on Win 2008 R2.

To detect a missing .NET framework on the server we defined as search condition as follows:

Criteria: Registry key does not exist
Value: HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5

Then we use the search criteria to control the execution of a custom action under InstallExecuteSequence->Begin. The custom action enables the .NET Framework feature on the server using the following command:

`[System64Folder]ServerManagerCmd.exe -install NET-Framework –restart`

During installation on a system which does not have the .NET framework feature enabled, the following happens:

1. The installer correctly identifies that the .NET feature is missing and runs the custom action to enable the feature. This is successful as we can see the feature appear in the feature list for the server.
2. The installer starts the installation of the MS SQL Server which fails complaining that the .NET framework is required.

However, if we restart the installation (and this time the .Net framework feature is already enabled from the first run), then the installer install MS SQL Server correctly.

Is there a way to find out why the installation package fails to install the SQL Server right after it enables the .NET Framework feature? For some reason the SQL Server install fails to detect the .NET Framework during the first run of the installation.

Thank you
Emil
prolancer
Posts: 17
Joined: Wed Nov 23, 2011 6:16 am

Re: Installation fails after enabling .NET on Win Server 200

Hi (again),

After some more testing we realised that the custom script that enables the .NET Framework feature runs after the installer goes through the installation of all pre-requisites, including the SQL Server.

So, the correct sequence of what happens is:

1. The installer attempts to install MS SQL Server as a pre-requisite. This obviously fails as the .NET Framework feature is not enabled.
2. The installer runs the custom action to enable the .NET Framework feature.

We have the custom action set to run under InstallExecuteSequence->Begin.

Where do we need to move the custom action to so it runs before pre-requisite installation and in particular before the installation of the SQL Server pre-requisite?

Thank you
Emil
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Installation fails after enabling .NET on Win Server 200

Hi Emil,

You can try to enable "Chain prerequisite installation after main package" option for SQL Server feature based prerequisite.

Another solution you can try is to also add .NET framework as a prerequisite and schedule it before all others. Their order is top-bottom in the prerequisites list.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
prolancer
Posts: 17
Joined: Wed Nov 23, 2011 6:16 am

Re: Installation fails after enabling .NET on Win Server 200

Hi Mihai,

thank you for taking the time to help us with this issue.
You can try to enable "Chain prerequisite installation after main package" option for SQL Server feature based prerequisite.
Unfortunately this is not an option as we need to install SQL Server before the main package which in turn creates a database in the SQL Server instance that we install as a pre-requsite.
Another solution you can try is to also add .NET framework as a prerequisite and schedule it before all others. Their order is top-bottom in the prerequisites list.
We do this for systems other than MS Server 2008 R2. On Win Server R2 you can not install .NET, instead you need to enable it as a feature. This is why we created the custom action which enables the .NET as a feature on systems with Win Server 2008 R2. We install the same package on Win server 2003 and have .NET install before MS SQL Server in the pre-requiste list and it all works fine.

Are you saying that there is no way to execute a custom action before global pre-requisite installation?

Thank you
Emil
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Installation fails after enabling .NET on Win Server 200

Hi Emil,
Are you saying that there is no way to execute a custom action before global pre-requisite installation?
You can try the following:
- develop your own custom .EXE that enables .NET
- add it as "Search done by a custom executable" for SQL Server global prerequisite's search criteria:
http://www.advancedinstaller.com/user-g ... earch.html
- since the .EXE inherits the parent process permissions, make sure you set "Require administrator" for your installer:
http://www.advancedinstaller.com/user-g ... a-uac.html

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
prolancer
Posts: 17
Joined: Wed Nov 23, 2011 6:16 am

Re: Installation fails after enabling .NET on Win Server 200

Hi Mihai,

does it need to be EXE file?

I created a BAT file which returns 0 all the time, however the installer always thinks that a suitable version of the pre-requsite has NOT been found.

How can I use a BAT file?

Thank you
Emil
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Installation fails after enabling .NET on Win Server 200

Hi Emil,

I'm afraid our prerequisites searches do not support a bat file, however you can try the following, even with the bat.

Besides the BAT that executes the install of .NET you need to create a new search, whatever you want, i.e. a file/registry/GUID search, and that search must be correctly resolved after the prerequisite is installed. Then you need to set the radio button "Install if any of the above searches fails".

After the prerequisite is installed the second search, not the BAT, should be correctly installed, so our setup should consider the prerequisite was correctly installed.

What you must be sure to check from your BAT is if .NET already exists on the machine, because the searches are executed multiple times, therefore your BAT will be launched more than once.

If this approach does not work either I'm afraid the only solution is to create your own EXE to launch the .NET install.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”