Using Inno Setup, I'm trying to check to see if the .NET 4.8 runtime is installed on a Windows computer. If it is not installed, I run the .NET 4.8 runtime installer exe file. According to Microsoft, you can check the registry at a certain location and look at a certain value to see which specific version of .NET is installed. Inno Setup has a function called RegQueryStringValue which grabs a value from the registry:
https://jrsoftware.org/ishelp/index.php?topic=isxfunc_regquerystringvalue
I am following that API correctly, as far as I'm aware. I have also confirmed, using regedit, that this registry key and value do exist on my system. However, when I run Inno Setup, it fails to find the registry value. Here is my code:
function IsDotnet48Installed: boolean;
var
valueStr: string;
valueInt: integer;
begin
if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', valueStr) then
begin
MsgBox('.NET 4.8 registry value is: "' + valueStr + '"', mbInformation, MB_OK);
valueInt := StrToInt(valueStr);
if valueInt >= 528040 then
result := true
else
result := false
end
else
MsgBox('Unable to find .NET 4.8 registry key', mbInformation, MB_OK);
end;
When the above code is ran, the RegQueryStringValue function returns false, and I thus get the message box that says "Unable to find .NET 4.8 registry key". I am not sure what I am doing wrong.
Thank you.