打包:独立运行的基于Arcgis Engine的应用程序(下)
采用Inno Setup
(1)获取
(2)拷贝
将目标软件(独立运行的基于Arcgis Engine的应用程序)的开发环境中Debug目录拷贝到E盘根目录,方便后面使用
(3)启动Inno Setup,并New一个脚本
(4)修改脚本内容
1)定义变量名
2)声明安装类型以及组件
3)拷贝文件
;ARCGIS Engine + Lincence Manager Source: "C:\Windows\System32\msiexec.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "E:\Resource\arcgis lincence manager 10.2\*"; DestDir: "{tmp}\{#ArcGISLincenceManager}"; Components: arcgis\lincencemanager; Flags: ignoreversion recursesubdirs createallsubdirs deleteafterinstall Source: "E:\Resource\arcgis engine 10.2\*"; DestDir: "{tmp}\{#ArcGISEngine}"; Components: arcgis\engine; Flags: ignoreversion recursesubdirs createallsubdirs deleteafterinstall
4)运行ArcGIS Lincence Manager和ArcGIS Engine的安装程序
Filename: "{app}\msiexec.exe";Parameters: "/i""{tmp}\{#ArcGISLincenceManager}\{#ArcGISLincenceManagerMsi}";Components: arcgis\lincencemanager;Flags: skipifsilent Filename: "{app}\msiexec.exe";Parameters: "/i""{tmp}\{#ArcGISEngine}\{#ArcGISEngineMsi}"; Components: arcgis\engine; Flags: skipifsilent
5)其他
包括卸载时关闭程序、清理文件夹及文件;安装时,对.net环境的检查;重复执行时,寻问是否卸载。
代码原文:
function InitializeSetup(): Boolean; var MykeynotExist: Boolean; ResultCode: Integer; uicmd: String; begin MykeynotExist:= true; if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{A8722393-32D5-4FAA-A581-BC535EC8C6F8}_is1', 'UninstallString', uicmd) then begin MyKeynotExist:= false; Exec(RemoveQuotes(uicmd), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode); end; result:= MykeynotExist if result then begin result := IsDotNetInstalled(net45, 0); if not Result then SuppressibleMsgBox(FmtMessage(SetupMessage(msgWinVersionTooLowError), ['.NET Framework', '4.5']), mbCriticalError, MB_OK, IDOK); end; end;