博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

inno setup打包.netframework

Posted on 2012-09-21 09:35  hyruur  阅读(268)  评论(0编辑  收藏  举报

[Files]
.........
Source: "F:/路径/dotnetfx20.exe"; DestDir: "{tmp}"; Flags: ignoreversion
; 友情提示:dotnetfx20.exe并不会拷贝到安装后的目录中,而是在临时目录中,这样重启机器之后就会被删除掉

[code]
function CheckDotNet2_0():boolean;
begin
Result:=not RegKeyExists(HKLM, 'SOFTWARE/Microsoft/.NETFramework/policy/v2.0');
end;

function InitializeSetup(): Boolean;
var Path:string;
    ResultCode: Integer;
begin
  if CheckDotNet2_0() then
  begin
    ExtractTemporaryFile('dotnetfx20.exe');
    Exec(ExpandConstant('{tmp}/dotnetfx20.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
  end;
  Result:=true;
end;