Installer Conditional Issue
I have almost completed our installer update, but there is one portion left, I need to check that the client has the FULL .NET Framework 4.0 installed. However The script I have written attempts to install it every time rather then only when its not present. Without a real time debugger I am a bit helpless to muck my way though, anyone mind taking a look.
The idea is first I will check that NET Framework Setup\NDP\v4\Full exists;
if yes then first attempt to install it from the included redistribution,
otherwise download it from microsoft.
Var InstallDotNET
Var DotNetOnCD
Section "CFO" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
; Begin Check .NET version
StrCpy $InstallDotNET "No"
ReadRegDWORD $0 HKLM "Software\Microsoft\NET Framework Setup\NDP\v4\Full" "Install"
${if} $0 == ""
StrCpy $InstallDotNET "Yes"
MessageBox MB_OK|MB_ICONINFORMATION "${PRODUCT_NAME} requires that the .NET Framework 4.0 is installed. The latest .NET Framework will be downloaded and installed automatically during installation of ${PRODUCT_NAME}."
IfFileExists "$EXEDIR\Redist\dotNetFx40_Full_x86_x64.exe" 0 +2
StrCpy $DotNetOnCD "Yes"
Pop $0
${Else}
StrCpy $InstallDotNet "No"
Pop $0
${EndIf}
; Get .NET if required
${If} $InstallDotNET == "Yes"
${AndIf} $DotNetOnCD == "Yes"
MessageBox MB_OK \
"Microsoft .NET 4 is required to run this application. \
Click 'OK' to start the installer for it."
SetCursor::System WAIT
Exec "$EXEDIR\Redist\dotNetFx40_Full_x86_x64.exe"
SetCursor::System NORMAL
${Else}
SetDetailsView hide
inetc::get /caption "Downloading .NET Framework 4.0" /canceltext "Cancel" "http://www.microsoft.com/downloads/info.aspx?na=41&SrcFamilyId=9CFB2D51-5FF4-4491-B0E5-B386F32C0992&SrcDisplayLang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f1%2fB%2fE%2f1BE39E79-7E39-46A3-96FF-047F95396215%2fdotNetFx40_Full_setup.exe" "$INSTDIR\dotnetfx.exe" /end
Pop $1
${If} $1 != "OK"
Delete "$INSTDIR\dotnetfx.exe"
Abort "Installation cancelled, ${PRODUCT_NAME} requires the .NET 4.0 Framework"
${EndIf}
ExecWait "$INSTDIR\dotnetfx.exe"
Delete "$INSTDIR\dotnetfx.exe"
SetDetailsView show
${EndIf}