InstallShield with .NET 4.5 nested installation

2019-08-12 22:26发布

问题:

My installer needs to redistribute the .NET framework, but I don't want to have a setup.exe wrapper so I've written a Custom Action to launch the web installer for .NET if the end-users machine does not already have it. This works perfectly fine with .NET 4.0 and .NET 3.5 but for .NET 4.5 the .NET installer reports "waiting for another install to complete" and fails - this error msg would be correct if my Custom Action was in the Exec sequence, but I specifically placed it very early in the UI sequence to allow for a nested installation.

The exact same InstallShield configuration/code works fine with .NET 3.5 and .NET 4.0 but fails with .NET 4.5, I'm using the standard web installer from Microsoft: http://www.microsoft.com/en-ca/download/details.aspx?id=30653

Does anyone know of any solution or workaround to this problem ?

Here's the code for my Custom Action:

if ( hasDotNET45 = FALSE ) then
    MessageBox( "Missing .NET 4.5 framework!", INFORMATION );
    LAAW_SHELLEXECUTEVERB = "runas";
    LaunchApplication( szSupportDir^"\\dotNetFx45_Full_setup.exe", "", "", SW_SHOWNORMAL, 100000, LAAW_OPTION_USE_SHELLEXECUTE | LAAW_OPTION_WAIT_INCL_CHILD );
    Delay( 333 );
endif;

回答1:

I'm surprised that .Net 4 and 3.5 even work like this; launching an installer that likely uses MSI under the hood as a custom action in your MSI installer is a bad idea.

If you want to make sure .Net4.5 (or any other piece of software) is present you either need to chain it before you start your installer ala Setup / Feature Prerequisites in Installshield or use the LaunchCondition table to prevent your installer from continuing if environment does not meet requirements.



回答2:

The solution is to first extract the contents of the .NET 4.5 installer executable using the command: dotnetfx45_full_x86_x64.exe /x

Then I can use a Custom Action in my UI sequence to invoke the .MSI version of the .NET installer (without it's setup.exe wrapper!)

msiexec.exe /i netfx_Full_x64.msi EXTUI=1 /l*v “Install.log”

This fully resolves my original question.