现在打包主要是使用 innosetup 这个软件来进行打包,支持录制脚本和手动编写脚本,比较好用。

此文章主要记录手写脚本,便于后期查询,借鉴。

文档:
; 自定义的宏,方便后期维护
#define MyAppName "良田讲课仪"
#define MyAppVersion "V1.0"
#define MyAppExeName "TMaker.exe"
#define MyAppPublisher "Eloam" [Setup]
AppId={{F382DAB1-E185-41EF-B6ED-32E86CC310B0}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion} ; 发布者 - 安装包文件版本 - 版权
AppPublisher={#MyAppPublisher}
VersionInfoVersion=1.0
VersionInfoCopyright={#MyAppPublisher} ; 默认安装文件夹路径 + 文件夹名称
DefaultDirName={pf}\{#MyAppName} ; 默认组名称,开始菜单中会用到这个名称
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes ; 打包后安装包的保存路径 - 打包后安装包的名称
OutputDir=output
OutputBaseFilename={#MyAppName} {#MyAppVersion} Compression=lzma
SolidCompression=yes ; 不允许重复安装
UsePreviousAppDir=no ; 安装包图标 & 卸载程序图标
SetupIconFile = bin\logo.ico
UninstallIconFile = bin\logo.ico ; 控制面板
UninstallDisplayIcon = {app}\logo.ico
Uninstallable=yes
UninstallDisplayName={#MyAppName} ; 签名
;SignTool=sha1
;SignTool=sha256 [Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Languages\ChineseSimp.isl" [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone [Files]
; exe
Source: "bin\MJPGDriver.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "bin\TMaker.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "bin\amcap v3.0.9.exe"; DestDir: "{app}"; Flags: ignoreversion ; 多语言
Source: "bin\test3_zh.qm"; DestDir: "{app}"; Flags: ignoreversion
Source: "bin\test3_en.qm"; DestDir: "{app}"; Flags: ignoreversion
Source: "bin\test3_zh_fanti.qm"; DestDir: "{app}"; Flags: ignoreversion ; flt & ini
Source: "bin\video.flt"; DestDir: "{app}"; Flags: ignoreversion
Source: "bin\conf.ini"; DestDir: "{app}"; Flags: ignoreversion ; 图标
Source: ".\bin\logo.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\bin\logo.png"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\bin\cursor.png"; DestDir: "{app}"; Flags: ignoreversion ; dll
Source: ".\bin\*.dll"; DestDir: "{app}"; Flags: ignoreversion ; 文件夹
Source: ".\bin\iconengines\*"; DestDir: "{app}\iconengines"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\bin\imageformats\*"; DestDir: "{app}\imageformats"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\bin\platforms\*"; DestDir: "{app}\platforms"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\bin\styles\*"; DestDir: "{app}\styles"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\bin\tessdata\*"; DestDir: "{app}\tessdata"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\bin\TextHeadUp\*"; DestDir: "{app}\TextHeadUp"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\bin\translations\*"; DestDir: "{app}\translations"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\bin\worddirect\*"; DestDir: "{app}\worddirect"; Flags: ignoreversion recursesubdirs createallsubdirs [INI]
Filename: "{app}\conf.ini"; Section: "software"; Key: "isHW"; String: "1";
Filename: "{userappdata}\Eloam\Cfg\lib.ini"; Section: "EL";Key: "consoleLevel"; String: "0" ; [Registry]
Root: HKLM; Subkey: Software\VisualPresent; ValueType: string; ValueName: huyangTmaker; ValueData: '123456'; Flags: uninsdeletekey ; 解决重复安装
[code]
// 安装时,检查程序是否已经安装
function GetInstalledVersion(): String;
var
InstalledVersion: String;
begin
InstalledVersion :='';
RegQueryStringValue(HKLM, 'Software\VisualPresent', 'huyangTmaker', InstalledVersion);
Result := InstalledVersion;
end;
function InitializeSetup(): Boolean;
var
PrevVer: String;
ResultCode: Integer;
Ret: Boolean;
begin
PrevVer := GetInstalledVersion();
result := true;
if length(PrevVer) > 0
then
begin
//如果发现程序已经安装过了
MsgBox ('该软件已经安装过, 请先卸载后再进行安装.', mbError, MB_OK);
result := false;
end;
end; [Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\logo.ico"
Name: "{group}\{cm:UninstallProgram, {#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename:"{app}\logo.ico" [Run]
Filename: "{app}\MJPGDriver.exe"; Parameters: "/verysilent /norestart"; Description: "{cm:LaunchProgram, MJPGDriver}"; Flags:postinstall waituntilterminated skipifsilent
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

innoSetup打包文件编写模板的更多相关文章

  1. InnoSetup 打包Winform程序

    在VS2012之前,我们做安装包一般都是使用VS自带的安装包制作工具来创建安装包的,VS2012.VS2013以后,微软把这个去掉,集成使用了InstallShield进行安装包的制作了,虽然思路差不 ...

  2. c++类模板分文件编写存在的问题

    c++分文件编写的编译机制: 各个文件独立编译,如果在某.cpp文件中出现了函数调用,但是在此.cpp文件并没有对应函数的实现.此时就会在函数调用出生成特定的符号,在之后的链接过程完成函数调用. C+ ...

  3. c++类模板之分文件编写问题及解决

    我们在实际项目中一般习惯头文件(.h)和源文件(.cpp)分开写,这样做的好处良多,但是如果遇到了类模板,这样可能会有一点儿问题. 我们通过一个例子来看: person.h: #pragma once ...

  4. Innosetup打包自动下载.net framework 动态库及替换卸载程序图标.

    在使用了一段时间微软自带的安装包打包工具后,总感觉不太顺利,于是便想着找一种更简单稳定的打包工具,这类工具其实还不少,最终经过各种考量,我们选择了 InnoSetup , 该工具是一个完全免费的Win ...

  5. Pdf File Writer 中文应用(PDF文件编写器C#类库)

    该文由小居工作室(QQ:2482052910)    翻译并提供解答支持,原文地址:Pdf File Writer 中文应用(PDF文件编写器C#类库):http://www.cnblogs.com/ ...

  6. Innosetup 设置文件的相对路径

    在使用innosetup自动化打包的过程中,如果打包配置文件要随代码一起提交,则需要将打包文件改为相对路径,以便在其它端也可以直接打包,而不需要再次修改文件路径参数. 添加自动化打包文件 1. 添加b ...

  7. InnoSetup打包时出现Interal error: CallSpawnServer: Unexpected response: $0.错误的解决办法

    如果在使用Innosetup打包软件时,如果出现Interal error: CallSpawnServer: Unexpected response: $0.错误, 如下图: 可以查看 Innose ...

  8. cmake使用总结(转)---工程主目录CMakeList文件编写

    在linux 下进行开发很多人选择编写makefile 文件进行项目环境搭建,而makefile 文件依赖关系复杂,工作量很大,搞的人头很大.采用自动化的项目构建工具cmake 可以将程序员从复杂的m ...

  9. vue中自定义html文件的模板

    如果默认生成的 HTML 文件不适合需求,可以创建/使用自定义模板. 一是通过 inject 选项,然后传递给定制的 HTML 文件.html-webpack-plugin 将会自动注入所有需要的 C ...

  10. 最简单的 K8S 部署文件编写姿势,没有之一!

    1. 头疼编写K8S部署文件? K8S yaml 参数很多,需要边写边查? 保留回滚版本数怎么设? 如何探测启动成功,如何探活? 如何分配和限制资源? 如何设置时区?否则打印日志是GMT标准时间 如何 ...

随机推荐

  1. cw attack

  2. Redis基础_五大数据类型和常用命令

    ## 1. Redis基本介绍 1.1 传统数据存储出现的问题 海量用户 高并发 罪魁祸首--关系型数据库: 性能瓶颈:磁盘IO性能低下 扩展瓶颈:数据关系复杂,扩展性差,不便于大规模集群 解决思路 ...

  3. 14 CodeTON Round 5 (Div. 1 + Div. 2, Rated, Prizes!)C. Tenzing and Balls(dp+前缀最大值优化)

    思路: dp还是挺明显的,思路可以参考最长上升子序列 有点dp的感觉 \(f[i]\)表示考虑前\(i\)个数,的最大值 当前数有两种删或不删 不删:\(f[i]=f[i-1]\); 删:\(f[i] ...

  4. Codeforces Round 770 (Div. 2)(数学异或奇偶性)

    B. Fortune Telling 拿到题目看数据范围之后就知道暴力显然是来不及的. 那么只能找性质. \(考虑x和x+3的不同 \quad 奇偶性不同\) \(然后考虑两种操作对于一个数的奇偶性的 ...

  5. (二)Git 学习之基础篇

    一.理论基础 1.1 Git 记录的是什么? Git 和其它版本控制系统(如 SVN)的主要差别在于 Git 对待数据的方式. 1.1.1 SVN 记录差异比较 从概念上来说,SVN 以文件变更列表的 ...

  6. vagrant 多个box的操作|共享目录失败

    本来机器上已经有一个Ubuntu的box了,今天想在安装一个centos的box,结果还折腾了很长时间. 多个机器的命令 添加box的时候需要使用名称,一个的时候可以忽略名称 vagrant box ...

  7. 创建 nest-websocket 服务 用于mock单点登录开发

    需求 有个单点登录的任务,但是都是现场的服务 api 和 websocket 都在现在 开发本机mock服务 本地搭建环境先模拟一下 资料 NestJS WebSocket 开始使用 https:// ...

  8. SecureCRT windows 登录 linux

    SecureCRT是一款支持SSH(SSH1和SSH2)的终端仿真程序,简单地说是Windows下登录UNIX或Linux服务器主机的软件.SecureCRT支持SSH,同时支持Telnet和rlog ...

  9. 基于4G的智能工牌解决方案特色解析

    前记  随着数字化的不断发展以及cat1模块的竞争加剧.cat1无论从成本或者功耗上,都进化的特别快.这样的前提下,让基于4G可穿戴产品逐渐成为现实可穿戴产品必备.能解决以前很多不能解决的问题.  作 ...

  10. Linux 运维工程师面试真题-2-Linux 命令及文件操作

    Linux 运维工程师面试真题-2-Linux 命令及文件操作 1.在/tmp/目录下创建 test.txt 文件,内容为: Hello,World! ,用一个命令写出来. 2.给 test.txt ...