I want to create an NSIS installer that checks for the .NET Framework and installs it if it\'s not there. Can you point me to a script for this? I\'m very new to NSIS.
I had an issue with the "DotNET.nsh" pluging, which you can find somwhere, and simply used this solution (for .net 4.0, full install - which I needed, you can as well limit it to the client package):
ClearErrors
ReadRegDWORD $0 HKLM "Software\Microsoft\Net Framework Setup\NDP\v4\Full" "Install"
IfErrors dotNet40NotFound
IntCmp $0 1 dotNet40Found
dotNet40NotFound:
Banner::show /set 76 "Installing .NET Framework 4.0" "Please wait"
File /nonfatal "tools\dotNetFx40_Full_setup.exe"
; if you don't have $TEMP already, add here:
; SetOutPath $TEMP
ExecWait "$TEMP\dotNetFx40_Full_setup.exe /passive /norestart"
Delete /REBOOTOK "$TEMP\dotNetFx40_Full_setup.exe"
Banner::destroy
dotNet40Found:
The banner stuff is optional, you could just use DetailPrint or the like.
This way, you pull along the Web installer for .NET 4.0, but it's pretty small
(as opposed to .NET versions which didn't have one). The installer does the downloading
if it's needed, and you don't need kilometers of NSIS code.