All, I am aware of the following methods to check the framework version in NSIS. For .NET4.0+ I currently use
Function IsDotNetInstalled
StrCpy $0 \"0\
Yes there is an official way to check if .NET Framework 4.5 is installed, even if it's not really friendly. From MSDN:
You can test whether the .NET Framework 4.5 or the .NET Framework 4 is installed by checking the
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
subkey in the registry for aDWORD
value namedRelease
. The existence of thisDWORD
indicates that the .NET Framework 4.5 has been installed on that computer. The value of Release is a version number. To determine if the final release version of the .NET Framework 4.5 is installed, check for a value that is equal to or greater than 378389.http://msdn.microsoft.com/en-us/library/hh925568.aspx
It means you first have to check if 4.0 is installed and then to check if there is a value named Release
in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
, if so then 4.5 is already installed (I think you can skip the check for a pre-release version).
EDIT: check this post here on SO for details about detecting older installed .NET versions and this MSDN article to distinguish between for 4.5.x versions.