[File]
Source: "****\dotnetfx45_full_x86_x64.exe"; DestDir: "{tmp}";Check:CheckDotNet4_5 ; CopyMode:onlyifdoesntexist;
[code]
function CheckDotNet4_0():boolean;
begin Result:=not RegKeyExists(HKLM, 'SOFTWARE/Microsoft/.NETFramework/policy/v4.0');
end;
function InitializeSetup(): Boolean; var Path:string; ResultCode: Integer;
begin
if CheckDotNet4_0()
then
begin ExtractTemporaryFile('dotNetFx40_Full_x86_x64.exe'); Exec(ExpandConstant('{tmp}/dotNetFx40_Full_x86_x64.exe'), '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
//注意
[Tasks]代码段Flags: unchecked 去掉默认就是选择的
[Files]代码段中加上Check:CheckDotNet4_0 ;就是一个检查是否处理的判断,其中IsNeedInstall是在[Code]代码段中自定义的一个函数。
[Run]代码段Flags加一个unchecked就是安装完毕,"运行本程序"不勾选,默认没有这一项
inno setup 官方解答地址
https://jrsoftware.org/ispphelp/index.php?topic=exec