innoSetup打包文件编写模板
作者:互联网
现在打包主要是使用 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 [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
标签:bin,ignoreversion,app,DestDir,Source,innoSetup,Flags,模板,打包 来源: https://www.cnblogs.com/shiyixirui/p/16170590.html