Inno Setup 软件封装
例子:
; 脚本用 Inno Setup 脚本向导 生成。
; 查阅文档获取创建 INNO SETUP 脚本文件的详细资料! #define MyAppName "隧道照明系统客户端程序"
#define MyAppVersion "1.5"
#define MyAppPublisher "深圳市泰达鑫信息科技有限公司"
#define MyAppURL "http://www.tdx-it.com/"
#define MyAppExeName "TunnelLighting.exe" [Setup]
; 注意: AppId 的值是唯一识别这个程序的标志。
; 不要在其他程序中使用相同的 AppId 值。
; (在编译器中点击菜单“工具 -> 产生 GUID”可以产生一个新的 GUID)
AppId={{71C8E092-1FB6-43ED-B5A4-CDD9281CC72D}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
LicenseFile=D:\InstallPackage\Client\License.txt
InfoAfterFile=D:\InstallPackage\Client\UpdateLog.txt.txt
OutputDir=D:\InstallPackage
OutputBaseFilename=TunnelLight
SetupIconFile=D:\InstallPackage\Server\InstallIcon.ico
Compression=lzma
SolidCompression=yes [Languages]
Name: "default"; MessagesFile: "compiler:Default.isl"
Name: "chinesesimp"; MessagesFile: "compiler:Languages\ChineseSimp.isl"
Name: "english"; MessagesFile: "compiler:Languages\English.isl" [Messages]
BeveledLabel={#MyAppPublisher}
ConfirmUninstall=您真的想要从电脑中卸载ISsample吗?%n%n按 [是] 则完全删除 % 以及它的所有组件;%n按 [否]则让软件继续留在您的电脑上. [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags:checkablealone
;unchecked [Files]
Source: "D:\Program Files\Inno Setup 5\Plugins\ISXDL.dll"; Flags: dontcopy
Source: "D:\InstallPackage\Client\TunnelLighting.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\Aga.Controls.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\Base.Common.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\Base.Common.pdb"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\Base.Controller.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\Base.Controller.pdb"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\Base.Dal.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\Base.Dal.pdb"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\Base.Model.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\Base.Model.pdb"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\License.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\TunnelLighting.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\TunnelLighting.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\TunnelLighting.pdb"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\TunnelLighting.vshost.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\TunnelLighting.vshost.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\TunnelLighting.vshost.exe.manifest"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\UpdateLog.txt.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\websocket-sharp.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\InstallPackage\Client\holePic\*"; DestDir: "{app}\holePic"; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享的系统文件使用 "Flags: ignoreversion" [Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon [Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent [Code] var
dotNetDownloadNeeded: boolean;
dotNetLocalPath:string; procedure isxdl_AddFile(URL, Filename: PAnsiChar);
external 'isxdl_AddFile@files:isxdl.dll stdcall';
function isxdl_DownloadFiles(hWnd: Integer): Integer;
external 'isxdl_DownloadFiles@files:isxdl.dll stdcall';
function isxdl_SetOption(Option, Value: PAnsiChar): Integer;
external 'isxdl_SetOption@files:isxdl.dll stdcall'; function DoInstallDotNet():boolean;
var
hWnd: Integer;
ResultCode: Integer;
begin
result := true;
hWnd := StrToInt(ExpandConstant('{wizardhwnd}')); // don’t try to init isxdl if it’s not needed because it will error on < ie 3
if dotNetDownloadNeeded then begin
isxdl_SetOption('label', '正在下载 Microsoft .NET Framework');
isxdl_SetOption('des-c-r-i-p-tion', '您还未安装Microsoft .NET Framework. 请您耐心等待几分钟,下载完成后会安装到您的的计算机中。');
if isxdl_DownloadFiles(hWnd) = then result := false;
end; if result = true then begin
if Exec(ExpandConstant(dotNetLocalPath), '/qb', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
// handle success if necessary; ResultCode contains the exit code
if not (ResultCode = ) then begin
result := false;
end;
end else begin
// handle failure if necessary; ResultCode contains the error code
result := false;
end;
end; end; //执行安装.net framework function PreInstallDotNet(dotNetName:string;dotNetDownloadUrl:string):boolean;
begin
if (not IsAdminLoggedOn()) then begin
MsgBox('您电脑安装 Microsoft .NET Framework 需要管理员权限', mbInformation, MB_OK);
Result := false;
end else begin
dotNetLocalPath := ExpandConstant('{src}') + '\'+dotNetName;
if not FileExists(dotNetLocalPath) then begin
dotNetLocalPath := ExpandConstant('{tmp}') + '\'+dotNetName;
if not FileExists(dotNetLocalPath) then begin
isxdl_AddFile(dotNetDownloadUrl, dotNetLocalPath);
dotNetDownloadNeeded := true;
end;
end; SetIniString('install', 'dotnetRedist', dotNetLocalPath, ExpandConstant('{tmp}\dep.ini'));
end; end;
//准备安装.net framework需要的条件(本地还是联网) function IsDotNetDetected(version: string; service:cardinal): boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
// 'v1.1.4322' .NET Framework 1.1
// 'v2.0.50727' .NET Framework 2.0
// 'v3.0' .NET Framework 3.0
// 'v3.5' .NET Framework 3.5
// 'v4\Client' .NET Framework 4.0 Client Profile
// 'v4\Full' .NET Framework 4.0 Full Installation
// 'v4.5' .NET Framework 4.5
//
// service -- Specify any non-negative integer for the required service pack level:
// 0 No service packs required
// 1, 2, etc. Service pack 1, 2, etc. required
var
key: string;
install, release, serviceCount: cardinal;
check45, success: boolean;
begin
// .NET 4.5 installs as update to .NET 4.0 Full
if version = 'v4.5' then begin
version := 'v4\Full';
check45 := true;
end else
check45 := false; // installation key group for all .NET versions
key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + version; // .NET 3.0 uses value InstallSuccess in subkey Setup
if Pos('v3.0', version) = then begin
success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
end else begin
success := RegQueryDWordValue(HKLM, key, 'Install', install);
end; // .NET 4.0/4.5 uses value Servicing instead of SP
if Pos('v4', version) = then begin
success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
end else begin
success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
end; // .NET 4.5 uses additional value Release
if check45 then begin
success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
success := success and (release >= );
end; result := success and (install = ) and (serviceCount >= service);
end;
//检测是否存在(已安装)特定版本的.net framework //----------------------------------- //取得自定义的配置
// Setup.ini
// [Custom]
// dotNetVersion = v4.5
function GetCustomConfig(key:string):string;
var
myValue:string;
begin
myValue:=ExpandConstant('{ini:{src}\Setup.ini,Custom,'+key+'}')
result := myValue;
end; function InitializeSetup(): Boolean;
begin
//do something result:= true;
end;
//初始化安装 function IsIncludeFramework(version: string): boolean;
var
isInclued:boolean;
begin //最高版本的
if IsDotNetDetected('v4.5',) then begin
isInclued := true;
end else if version = 'v4.5' then begin
PreInstallDotNet('dotNetFx45_Full_setup.exe','http://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_setup.exe');
end else if IsDotNetDetected('v4\Full',) then begin
isInclued := true;
end else if version = 'v4\Full' then begin
PreInstallDotNet('dotNetFx40_Full_x86_x64.exe','http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe');
end else if IsDotNetDetected('v4\Client',) then begin
isInclued := true;
end else if version = 'v4\Client' then begin
PreInstallDotNet('dotNetFx40_Client_x86_x64.exe','http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe');
end else if IsDotNetDetected('v3.5',) then begin
isInclued := true;
end else if Pos('v3.5',version) = then begin
PreInstallDotNet('dotNetFx35setup.exe','http://download.microsoft.com/download/7/0/3/703455ee-a747-4cc8-bd3e-98a615c3aedb/dotNetFx35setup.exe');
end else if IsDotNetDetected('v3.0',) then begin
isInclued := true;
end else if Pos('v3.0',version) = then begin
PreInstallDotNet('dotNetFx35setup.exe','http://download.microsoft.com/download/7/0/3/703455ee-a747-4cc8-bd3e-98a615c3aedb/dotNetFx35setup.exe');
end else if IsDotNetDetected('v2.0.50727',) then begin
isInclued := true;
end else if Pos('v2',version) = then begin
PreInstallDotNet('dotnetfx.exe','http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe');
end else if IsDotNetDetected('v1.1.4322',) then begin
isInclued:= true;
end else if Pos('v1',version)= then begin
PreInstallDotNet('dotNetFx35setup.exe','http://download.microsoft.com/download/7/0/3/703455ee-a747-4cc8-bd3e-98a615c3aedb/dotNetFx35setup.exe');
end; result := isInclued;
end; //检测是否安装了等于大于指定版本的.net framework
function NextButtonClick(CurPage: Integer): Boolean;
var
dotNetVersion:string;
begin
Result := true; if (CurPage = wpReady) then begin dotNetVersion := GetCustomConfig('dotNetVersion');
if Length(dotNetVersion) = then begin
dotNetVersion := 'v4.0';
end else if not (Pos('v',dotNetVersion) = ) then begin
dotNetVersion := 'v'+dotNetVersion;
end; if not IsIncludeFramework(dotNetVersion) then begin
if not DoInstallDotNet() then begin
MsgBox('当前操作需要安装.NET Framework ' + dotNetVersion + '或以上版本。'##
'在尝试自动安装期间,似乎出现一些小问题(或用户取消了安装),'#
'请重试尝试安装。', mbInformation, MB_OK);
result:= false;
end;
end; end; end;
//安装出错或取消时 procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
ErrorCode: Integer;
begin
case CurUninstallStep of
usUninstall:
begin
// 正在卸载
end;
usPostUninstall:
begin
//卸载完成
ShellExec('open', 'http://www.tdx-it.com', '', '', SW_SHOW, ewNoWait, ErrorCode) end;
end;
end; //软件卸载
Inno Setup 软件封装的更多相关文章
- [InnoSetup]Inno Setup软件打包脚本
脚本由 Inno Setup 脚本向导 生成! ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档! #define MyAppName "SFT期货交易系统&quo ...
- 分享一个自用的 Inno Setup 软件打包脚本
此脚本支持打包mysql.安装mysql服务.安装windows服务.操作ini文件.操作注册表.高效压缩文件等功能,基本能满足常用的软件打包需求. ;定义各种常量 #define MyAppName ...
- inno setup 软件打包
2017-05-26 软件开发完毕以后,要进行打包发布,有几款打包用的软件很常见:innosetup,nullsoft,installshield.本人今天终于把自己独立开发的呈现软件打了包.第一个版 ...
- 使用Inno Setup 制作软件安装包详细教程(与开发语言无关)
前言:关于如何制作一个软件安装包的教程,与编程语言无关.以下,请看详情~ 1.下载Inno Setup,下载地址:https://jrsoftware.org/isinfo.php 2.下载最新版本即 ...
- Inno Setup 编译器
Inno Setup 编辑 Inno Setup用Delphi写成,其官方网站同时也提供源程序免费下载.它虽不能与Installshield这类恐龙级的安装制作软件相比,但也当之无愧算是后起之秀.In ...
- [Tool]Inno Setup创建软件安装程序。
这篇博客将介绍如何使用Inno Setup创建一个软件安装程序. Inno Setup官网:http://www.jrsoftware.org/isinfo.php. 可以下载到最新的Inno Set ...
- Inno setup 开源的安装包打包软件
Inno Setup是一个开源的安装包打包软件,下载地址是:http://www.jrsoftware.org/isdl.php 使用引导界面创建一个安装包打包 配置参考官方文档:http://www ...
- [Azure DevOps] 使用 Inno Setup 制作桌面软件安装包
1. 桌面应用程序的 CI/CD 桌面应用程序的 CI/CD 过程和网站有一些不同,毕竟桌面应用程序的"部署"只是将安装包分发到目标位置,连应用商店都不用上,根据公司的管理流程可以 ...
- 如何部署安装软件:vs2010 'VS' Inno Setup
一直以来就是调试程序,生成的文件在debug或者release下,当没有其他资源文件时,这些程序也不用打包,直接就能够运行,但是程序中总会有一些额外的资源文件,视频啊,图片啊.这些需要打包在一个安装文 ...
随机推荐
- sprintf函数的用法
说明1:该函数包含在stdio.h的头文件中,使用时需要加入:#include <stdio.h> 说明2:sprintf与printf函数的区别:二者功能相似,但是sprintf函数打印 ...
- Linux下安装系统清理软件 BleachBit 1.4
sudo add-apt-repository ppa:n-muench/programs-ppasudo apt-get updatesudo apt-get install bleachbit
- Java 对比Vector、ArrayList、LinkedList
①引言 在日常生活中能高效的管理和操作数据是非常重要的.Java提供了强大的集合框架,大大提高了开发者的生产力,今天就了解一下有关集合框架方面的问题. Vector.ArrayList.LinkedL ...
- react headtop title 截取
render() { const nav = this.props.nav const text = nav && nav.length > 5 ? this.strHandle ...
- 20145315 《Java程序设计》第二周学习总结
20145315 <Java程序设计>第二周学习总结 教材学习内容总结 类型 类型:整数分为short,int,long形. 字节:长度为一字节. 浮点数:储存小数,float和doubl ...
- HeyWeGo第五周项目总结
HeyWeGo第五周项目总结 项目内容 使用java程序开发一款扫雷游戏 游戏项目规划: 确定游戏中方块格子的个数 确定游戏中地雷的个数(初始10个),完成布雷 计算每个方块周围的雷数,在方块周围本身 ...
- Tensorflow代码解析(一)
http://www.leiphone.com/news/201702/n0uj58iHaNpW9RJG.html?utm_source=tuicool&utm_medium=referral ...
- ubuntu 18.04 64bit build tensorflow report error:C++ compilation of rule '//tensorflow/core/kernels:broadcast_to_op' failed (Exit 4)
注意:笔者未能在Ubuntu18.04 64bit下成功从源码编译cpu版本的tensorflow Ans: 1.You are likely running out of memory. Try r ...
- Anaconda ubuntu16.04 Cuda 8.0安装pytorch
Pytorch 安装 Pytorch安装真的太让人省心了,在anaconda的环境下进行安装,只需要一个命令 具体命令请查看官网pytorch 找到适合你的版本进行安装 本机环境: anaconda3 ...
- 广播地址设为自己的ip地址,子网掩码设为255.255.255.255 是什么意思
最近看<构建高性能web站点>(老版)第12章讲LVS-DR的配置,有一段针对Real Server的配置不明所以: ifconfig lo:0 125.12.12.77 broadcas ...