I wanted to share the actual Inno Setup code that I wrote, which specifically answers my question. Thanks to the previous answer for pushing me in the right direction.
function FindFramework45(): Boolean;
var
bVer4x5: Boolean;
bSuccess: Boolean;
iInstalled: Cardinal;
strVersion: String;
iPos: Cardinal;
begin
Result := False;
bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Install', iInstalled);
if (1 = iInstalled) AND (True = bSuccess) then
begin
bSuccess := RegQueryStringValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Version', strVersion);
if (True = bSuccess) then
Begin
iPos := Pos('4.5.', strVersion);
if (0 < iPos) then bVer4x5 := True;
End
end;
if (True = bVer4x5) then begin
Result := True;
end;
end;
The NextButtonClick() event would call this function right after the welcome.
The File and Run sections merely contain a function which uses the Check and checks that variable.
[Run]
Filename: "{app}\dotNetFx45_Full_setup.exe"; Parameters: "/q"; StatusMsg: "Installing Microsoft .Net 4.5 Framework..."; Check: InstallFramework45();
[Files]
Source: "{#MySourceBaseDir}\{#MyAppVersion}\{#MyDirBinaries}\dotNetFx45_Full_setup.exe"; Flags: deleteafterinstall; DestDir: "{app}"; Check: InstallFramework45();
I will state the obvious that one has to make sure that .Net Framework 4.0 is installed first and then check / install .Net Framework 4.5.
Now, if System.Data.SQLite.org would come out with a Visual Studio 2012 compliant version, I can check off my other big upgrade task.
Update: 2010.10.11 (Per TLana's comment)
Note: I decided to leave the original code, because I figure that others would like to see where I started. The code below is where I am at now. The code below also uses the proper registry location and checks for both .Net 4.0 and the new .Net 4.5. What about the future? When .Net 6.0 and 6.5 comes out, all that is needed is change the 4 to a 6, unless Microsoft changes the formula. it seems that the .5 upgrade is not a new framework but an upgrade to the existing one.
[Files]
Source: "{#MySourceBaseDir}\{#MyDirBinaries}\dotNetFx40_Full_x86_x64.exe"; Flags: deleteafterinstall; DestDir: "{app}"; Check: Framework40IsNotInstalled();
Source: "{#MySourceBaseDir}\{#MyDirBinaries}\dotNetFx45_Full_setup.exe"; Flags: deleteafterinstall; DestDir: "{app}"; Check: Framework45IsNotInstalled();
Source: "{#MySourceBaseDir}\{#MyDirBinaries}\mysql-connector-net-6.5.4.msi"; Flags: deleteafterinstall; DestDir: "{tmp}";
[Run]
Filename: "{app}\vcredist_x86.exe"; Parameters: "/q"; StatusMsg: "Installing Microsoft Visual C++ 2010 Redistributable Package...";
Filename: "{app}\dotNetFx40_Full_x86_x64.exe"; Parameters: "/q"; StatusMsg: "Installing Microsoft .Net 4.0 Full Framework..."; Check: Framework40IsNotInstalled();
Filename: "{app}\dotNetFx45_Full_setup.exe"; Parameters: "/q"; StatusMsg: "Installing Microsoft .Net 4.5 Framework..."; Check: Framework45IsNotInstalled();
Filename: "msiexec"; Parameters: "/package ""{tmp}\mysql-connector-net-6.5.4.msi"" /quiet"; StatusMsg: "Installing MySQL Connector...";
[Code]
function Framework40IsNotInstalled: Boolean;
var
bVer4x0Client: Boolean;
bVer4x0Full: Boolean;
bSuccess: Boolean;
iInstalled: Cardinal;
begin
Result := True;
bVer4x0Client := False;
bVer4x0Full := False;
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 := False;
end;
end;
function Framework45IsNotInstalled: Boolean;
var
bVer4x5: Boolean;
bSuccess: Boolean;
iInstalled: Cardinal;
strVersion: String;
iPos: Cardinal;
begin
Result := True;
bVer4x5 := False;
bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Install', iInstalled);
if (1 = iInstalled) AND (True = bSuccess) then
begin
bSuccess := RegQueryStringValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Version', strVersion);
if (True = bSuccess) then
Begin
iPos := Pos('4.5.', strVersion);
if (0 < iPos) then bVer4x5 := True;
End
end;
if (True = bVer4x5) then begin
Result := False;
end;
end;