All, I have the following NSIS function that checks for .NET4.5+ and if it is not installed the web installer is launched (if there is an internet connection) and the installation proceeds once .NET4.5 has been installed. This works fine for Windows 7 and 8, but it is not working correctly for Windows XP. The function is
Function CheckAndInstallDotNet
; Installer dotNetFx45_Full_setup.exe avalible from http://msdn.microsoft.com/en-us/library/5a4x27ek.aspx
; Magic numbers from http://msdn.microsoft.com/en-us/library/ee942965.aspx
ClearErrors
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Release"
IfErrors NotDetected
${If} $0 >= 378181 ;378389
DetailPrint "Microsoft .NET Framework 4.5 is installed ($0)"
${Else}
NotDetected:
MessageBox MB_YESNO|MB_ICONQUESTION ".NET Framework 4.5+ is required for UserCost2013, \
do you want to launch the web installer? This requires a valid internet connection." IDYES InstallDotNet IDNO Cancel
Cancel:
MessageBox MB_ICONEXCLAMATION "To install UserCost2013, Microsoft's .NET Framework v${DOT_MAJOR}.${DOT_MINOR} \
(or higher) must be installed. Cannot proceed with the installation!"
${OpenURL} "${WWW_MS_DOTNET4_5}"
RMDir /r "$INSTDIR"
SetOutPath "$PROGRAMFILES"
RMDir "$INSTDIR"
Abort
; Install .NET4.5.
InstallDotNet:
DetailPrint "Installing Microsoft .NET Framework 4.5"
SetDetailsPrint listonly
ExecWait '"$INSTDIR\dotNETFramework\dotNetFx45_Full_setup.exe" /passive /norestart' $0
${If} $0 == 3010
${OrIf} $0 == 1641
DetailPrint "Microsoft .NET Framework 4.5 installer requested reboot."
SetRebootFlag true
${EndIf}
SetDetailsPrint lastused
DetailPrint "Microsoft .NET Framework 4.5 installer returned $0"
${EndIf}
; Now remove the dotNETFramework directory and contents.
RMDir /r "$INSTDIR\dotNETFramework"
;Delete "$INSTDIR\dotNETFramework\dotNetFx45_Full_setup.exe"
;RMDir "$INSTDIR\dotNETFramework"
FunctionEnd
The problem is with ExecWait
, it executes the web-installer 'dotNetFx45_Full_setup.exe' and unpacks the required temporary files. Then, when in the Win7/8 case it launches the installer, in XP it does not. instead it proceeds to install my application without .NET being installed. Needless to say this is causing issues for XP users.
How can I get this function working properly in XP?
Thanks for your time.