How do I detect in the Windows Registry if a user has .Net Framework installed? I am not looking for a .Net based solution, as the query is from InnoSetup.
I know from reading another post here on Stack Overflow that .Net Framework is an inplace upgrade to 4.0.
I already know how to check if a user has version 4.0 installed on the system, namely by checking the following:
function FindFramework(): Boolean;
var
bVer4x0: Boolean;
bVer4x0Client: Boolean;
bVer4x0Full: Boolean;
bSuccess: Boolean;
iInstalled: Cardinal;
begin
Result := False;
bVer4x0Client := False;
bVer4x0Full := False;
bVer4x0 := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\.NETFramework\policy\v4.0');
bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4 \Client', 'Install', iInstalled);
if (1 = iInstalled) AND (True = bSuccess) then bVer4x0Client := True;
bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4 \Full', 'Install', iInstalled);
if (1 = iInstalled) AND (True = bSuccess) then bVer4x0Full := True;
if (True = bVer4x0Full) then begin
Result := True;
end;
end;
I checked the registry and there is no v4.5 folder, which makes sense if .Net Framework 4.5 is an inplace upgrade. Still, the Control Panel Programs and Features includes the listing.
I know that probably "issuing dotNetFx45_Full_setup.exe /q" will have no bad effect if installing on a system that already has version 4.5, but I still would like to not install the upgrade if the upgrade already exists, faster and less problems.