Here's some code I found in the Inno Setup Knowledge Base. It shows how to detect the .NET framework and displays a message. If you want Inno to install it you can direct the code to install it by
running the redistributable from the code.
The code below works with InnoSetup 5.x.
[Setup]
AppName=NETFramewrok
AppVerName=NETFramewrok
DefaultDirName={pf}\NETFra
DisableStartupPrompt=true
[Code]
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
NetFrameWorkInstalled : Boolean;
Result1 : Boolean;
begin
NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWAR
if NetFrameWorkInstalled =true then
begin
Result1 := MsgBox('.NET Framework v2 is currently installed.',
mbConfirmation, MB_YESNO) = idYes;
Result := true;
end;
if NetFrameWorkInstalled = false then
begin
NetFrameWorkInstalled := RegKeyExists(HKLM,'SOFTWAR
if NetFrameWorkInstalled = true then
begin
Result := true;
end;
if NetFrameWorkInstalled =false then
begin
Result1 := MsgBox('This setup requires the .NET Framework. Please download and install the .NET Framework and run this setup again. Do you want to download the framwork now?',
mbConfirmation, MB_YESNO) = idYes;
if Result1 =false then
begin
Result:=false;
end
else
begin
Result:=false;
//Run the .NET redistributable here using shellexec.
end;
end;
end;
end;
Main Topics
Browse All Topics





by: myesterPosted on 2007-02-21 at 11:50:29ID: 18581455
One more thing. If the dotnet framework is not found I'd like to have it installed and then my application setup to cointinue