I'm developing an application in C#. I'm trying to create the installation pack using Inno Setup, but I need to check if the user has the .NET framework installed. I did this, but here goes the problem: if the user doesn't want to install the .NET 4, the program needs to cancel the installation. How can I do this?
[Run]
Filename: "{app}\dotNetFx40_Full_x86_x64.exe"; Check: FrameworkIsNotInstalled
Filename: "{app}\sis_visu_ipccV2.0.exe"; Description: "{cm:LaunchProgram,SisIPCCAR4}"; Flags: nowait postinstall skipifsilent
[Code]
function FrameworkIsNotInstalled: Boolean;
begin
if MsgBox('Foi detectado que seu computador não possui o .NET Framework 4.0. Para que o aplicativo execute normalmente é necessário tê-lo instalado. Deseja instalar? ', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then
begin
Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NETFramework\policy\v4.0');
end
else begin
Abort;
end;
end;
function InitializeSetup(): Boolean;
and then pass the result (e.g. asQ
) from Message Box to the Result of this function. E.g.if Q = IDYES then Result := True);
what will continue the Setup. – RobeN