Code:
function VerifyDotNetVersion(DotNetKey, MinimumDotNetVersionNumber, MinimumDotNetVersionName) local DotNetVersionFound = false; if (Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, DotNetKey)) then local DotNetVersion = Registry.GetValue(HKEY_LOCAL_MACHINE, DotNetKey, "Release", true); if DotNetVersion >= MinimumDotNetVersionNumber then DotNetVersionFound = true; end end if not DotNetVersionFound then Dialog.Message(SessionVar.Expand("%ProductName%").." Setup", "Installation of the Microsoft .NET Framework " .. MinimumDotNetVersionName .. SessionVar.Expand(" or above is a prerequisite to run the %ProductName%. It is not included with this installation. It will need to be downloaded from Microsoft's website and installed on the workstation before continuing.\r\n\r\nPlease contact eFreedom Annual Statement Support at %SupportPhone% for additional information and further instructions.\r\n\r\nClick OK to exit this installation."), MB_OK, MB_ICONSTOP); Application.Exit(3); end; end
Then we call it from OnStartup with (use the correct version number for the .NET version you are checking for)
Code:
-- .NET 4 Reg Key local DotNetKey = "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full"; -- .NET 4.5.2 Build Number local MinimumDotNetVersion = "461308"; local MinimumDotNetVersionName = "v4.7.1"; VerifyDotNetVersion(DotNetKey, MinimumDotNetVersion, MinimumDotNetVersionName);
Greg
Leave a comment: