2012年2月19日星期日

在InnoSetup中检测和安装.NET Framework和MySQL Connector/NET

 

[Files]
Source: "D:\VOS\share\tncs\dotnetfx.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
Source: "D:\VOS\share\tncs\mysql-connector-net-6.4.3.msi"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall 
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”

[Run]
Filename: "{tmp}\dotnetfx.exe"; Parameters: “/Q /NORESTART”; Check: IsFramework20Installed; Flags: runhidden shellexec waituntilterminated hidewizard;
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\mysql-connector-net-6.4.3.msi"""; Check: IsMysqlConnectorNetInstalled; Flags: hidewizard

[Code]  
function IsFramework20Installed():Boolean;
begin
    Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\.NetFramework\Policy\v2.0');
end;

function IsMysqlConnectorNetInstalled():Boolean;
begin
    Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\MySQL AB\MySQL Connector/Net');
end;

没有评论:

发表评论