Simple Way To Install .NET Framework: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Added .NET Framework 4)
Line 4: Line 4:
== How To Use ==
== 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:
First copy the script into your NSIS script. Using the list below, change NETVersion to the right version and download the installer:
*4.0 - http://www.microsoft.com/download/en/details.aspx?id=17718
*3.5 - http://www.filehippo.com/download_dotnet_framework_3/
*3.5 - http://www.filehippo.com/download_dotnet_framework_3/
*3.0 - http://www.filehippo.com/download_dotnet_framework_3/3481/
*3.0 - http://www.filehippo.com/download_dotnet_framework_3/3481/
Line 10: Line 11:
*1.0.3705 - http://www.filehippo.com/download_dotnet_framework_1/
*1.0.3705 - http://www.filehippo.com/download_dotnet_framework_1/
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.
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 ==
== Example Section ==
<highlight-nsis>
<highlight-nsis>

Revision as of 18:55, 25 January 2012

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

Reference

How to determine which versions of the .NET Framework are installed and whether service packs have been applied