Simple Way To Install .NET Framework: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
(created page) |
|||
Line 29: | Line 29: | ||
== Reference == | == Reference == | ||
[http://msdn.microsoft.com | [http://msdn.microsoft.com/kb/kbarticle.aspx?id=318785 How to determine which versions of the .NET Framework are installed and whether service packs have been applied] | ||
[[Category:Code Examples]] | [[Category:Code Examples]] | ||
[[Category:Other Products Version Detection Functions]] | [[Category:Other Products Version Detection Functions]] |
Revision as of 16:26, 5 June 2011
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:
- 3.5 - http://www.filehippo.com/download_dotnet_framework_3/
- 3.0 - http://www.filehippo.com/download_dotnet_framework_3/3481/
- 2.0.50727 - http://www.filehippo.com/download_dotnet_framework_2/
- 1.1.4322 - 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.
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