例子:

       ; 脚本用 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 软件封装的更多相关文章

  1. [InnoSetup]Inno Setup软件打包脚本

     脚本由 Inno Setup 脚本向导 生成! ; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!   #define MyAppName "SFT期货交易系统&quo ...

  2. 分享一个自用的 Inno Setup 软件打包脚本

    此脚本支持打包mysql.安装mysql服务.安装windows服务.操作ini文件.操作注册表.高效压缩文件等功能,基本能满足常用的软件打包需求. ;定义各种常量 #define MyAppName ...

  3. inno setup 软件打包

    2017-05-26 软件开发完毕以后,要进行打包发布,有几款打包用的软件很常见:innosetup,nullsoft,installshield.本人今天终于把自己独立开发的呈现软件打了包.第一个版 ...

  4. 使用Inno Setup 制作软件安装包详细教程(与开发语言无关)

    前言:关于如何制作一个软件安装包的教程,与编程语言无关.以下,请看详情~ 1.下载Inno Setup,下载地址:https://jrsoftware.org/isinfo.php 2.下载最新版本即 ...

  5. Inno Setup 编译器

    Inno Setup 编辑 Inno Setup用Delphi写成,其官方网站同时也提供源程序免费下载.它虽不能与Installshield这类恐龙级的安装制作软件相比,但也当之无愧算是后起之秀.In ...

  6. [Tool]Inno Setup创建软件安装程序。

    这篇博客将介绍如何使用Inno Setup创建一个软件安装程序. Inno Setup官网:http://www.jrsoftware.org/isinfo.php. 可以下载到最新的Inno Set ...

  7. Inno setup 开源的安装包打包软件

    Inno Setup是一个开源的安装包打包软件,下载地址是:http://www.jrsoftware.org/isdl.php 使用引导界面创建一个安装包打包 配置参考官方文档:http://www ...

  8. [Azure DevOps] 使用 Inno Setup 制作桌面软件安装包

    1. 桌面应用程序的 CI/CD 桌面应用程序的 CI/CD 过程和网站有一些不同,毕竟桌面应用程序的"部署"只是将安装包分发到目标位置,连应用商店都不用上,根据公司的管理流程可以 ...

  9. 如何部署安装软件:vs2010 'VS' Inno Setup

    一直以来就是调试程序,生成的文件在debug或者release下,当没有其他资源文件时,这些程序也不用打包,直接就能够运行,但是程序中总会有一些额外的资源文件,视频啊,图片啊.这些需要打包在一个安装文 ...

随机推荐

  1. Singapore retailer will release this adidas NMD R1

    Select spots are restocking the adidas NMD Singapore this Friday, Feb 24th featuring three different ...

  2. C语言的 32个关键之和9个控制语言之关键字

    auto   break  case  char  const  continue  default  do double  else  enum  extern  float for  goto  ...

  3. EditPlus 4.3.2463 中文版已经发布(10月16日更新)

    距离上个版本在本年5月发布后,EditPlus 网站沉寂多月.日前终于发布了一个新的小版本. 该版本却具有多项改进,值得一提: * Ctrl+Alt+Up/Down 键在列选模式下可插入多个插入点. ...

  4. ListView的ScrollBar设置

    默认ListView的滑动时,右侧会有滑动条显示,等ListView滑动结束时,滑动条消失.修改ScrollBar的显示可以在XML以及CODE中实现. CODE中实现:1.setFastScroll ...

  5. Vue学习笔记之Vue组件

    0x00 前言 vue的核心基础就是组件的使用,玩好了组件才能将前面学的基础更好的运用起来.组件的使用更使我们的项目解耦合.更加符合vue的设计思想MVVM. 那接下来就跟我看一下如何在一个Vue实例 ...

  6. HDU 5934 Bomb(tarjan/SCC缩点)题解

    思路:建一个有向图,指向能引爆对象,把强连通分量缩成一点,只要点燃图中入度为0的点即可.因为入度为0没人能引爆,不为0可以由别人引爆. 思路很简单,但是早上写的一直错,改了半天了,推倒重来才过了... ...

  7. Redis之Set 集合

    Redis Set 集合 Set 就是一个集合,集合的概念就是一堆不重复值的组合.利用 Redis 提供的 Set 数据结构,可以存储一些集合性的数据. 比如在 微博应用中,可以将一个用户所有的关注人 ...

  8. Codeforces Round #394 (Div. 2) B. Dasha and friends(暴力)

    http://codeforces.com/contest/761/problem/B 题意: 有一个长度为l的环形跑道,跑道上有n个障碍,现在有2个人,给出他们每过多少米碰到障碍,判断他们跑的是不是 ...

  9. 解决"No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android"错误

    今天安装了Android Studio 3.2,打开一个旧工程,编译提示"No toolchains found in the NDK toolchains folder for ABI w ...

  10. 详解java中CAS机制所导致的问题以及解决——内存顺序冲突

    [CAS机制] 指的是CompareAndSwap或CompareAndSet,是一个原子操作,实现此机制的原子类记录着当前值的在内存中存储的偏移地址,将内存中的真实值V与旧的预期值A做比较,如果不一 ...