Simple Way To Install .NET Framework
From NSIS Wiki
Jump to navigationJump to search
Information
After looking at the other examples of how to detect the current Microsoft .NET Framework on the computer, they all don't seem to be looking in the right place. If you do a search on the MSDN website you will see that it has some documentation on how to see if a version of the .NET framework is installed.
How To Use
First copy the script into your NSIS script. Using the list below, change NETVersion to the right version and download the installer:
Then move the .NET installer to the folder with NSIS and change NETInstaller to the filename. Compile your script and test it, if you have the framework installed then it wont install and if it isnt, then it will install.
Example Section
!define NETVersion "3.5" !define NETInstaller "dotNetFx35setup.exe" Section "MS .NET Framework v${NETVersion}" SecFramework IfFileExists "$WINDIR\Microsoft.NET\Framework\v${NETVersion}" NETFrameworkInstalled 0 File /oname=$TEMP\${NETInstaller} ${NETInstaller} DetailPrint "Starting Microsoft .NET Framework v${NETVersion} Setup..." ExecWait "$TEMP\${NETInstaller}" Return NETFrameworkInstalled: DetailPrint "Microsoft .NET Framework is already installed!" SectionEnd