inno setup打包软件学习

本文涉及的产品
文本翻译,文本翻译 100万字符
语种识别,语种识别 100万字符
图片翻译,图片翻译 100张
简介: 如何使用Inno Setup打包软件,包括打包结果的展示、示例打包脚本的提供、常见错误的解决方法,以及参考资料的链接。文中详细解释了解决“另一个程序正在使用此文件”和“桌面图标无法修改”等问题的方法,以及如何正确设置打包脚本中的文件路径和图标。

一 打包结果

测试程序来自:

泽森科工 (zenustech.com)

二 示例打包脚本

使用打包软件下载地址:

innosetup-6.2.2.exe US 7,155 2023-02-15 Unicode Inno Setup self-installing package.

#define MyAppName "zeno2"
#define MyAppVersion "1.0.0.0"
#define MyAppPublisher "深圳泽森科技有限公司"
#define MyAppURL "https://zenustech.com/"
#define MyAppExeName "zenoedit.exe"
#define MyAppAssocName "zeno graph"
#define MyAppAssocExt ".zsg"
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt

[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (若要生成新的 GUID,可在菜单中点击 "工具|生成 GUID")
AppId={
   {
   60491560-173F-4E0D-9FB6-2CCE50C94FF5};
AppName={
   #MyAppName}
AppVersion={
   #MyAppVersion}
;AppVerName={
   #MyAppName} {
   #MyAppVersion}
AppPublisher={
   #MyAppPublisher}
AppPublisherURL={
   #MyAppURL}
AppSupportURL={
   #MyAppURL}
AppUpdatesURL={
   #MyAppURL}
DefaultDirName={
   autopf}\{
   #MyAppName}
ChangesAssociations=yes
DisableProgramGroupPage=yes
; 以下行取消注释,以在非管理安装模式下运行(仅为当前用户安装)。
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputDir=C:\Users\pgjgg\Desktop\work\202302\zeno
OutputBaseFilename=zeno2_setup
Compression=lzma
SolidCompression=yes
WizardStyle=modern

[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\Alembic.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\assimp-vc143-mt.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\assimp-vc143-mt.dll.manifest"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\assimp-vc143-mt.exp"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\assimp-vc143-mt.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\brotlicommon.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\brotlidec.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\Bullet3Common.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\BulletCollision.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\BulletDynamics.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\BulletInverseDynamics.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\BulletSoftBody.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\BussIK.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\bz2.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\cudart64_12.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\cufft64_11.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\cufftw64_11.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\freetype.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\HACD.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\harfbuzz.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\hdf5.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\icudt71.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\icuin71.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\icuuc71.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\Iex-3_1.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\IlmThread-3_1.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\Imath-3_2.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\IrrXML.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\jpeg62.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\libblosc.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\libomp140.x86_64.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\libopenvdb.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\libpng16.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\LinearMath.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\nvrtc64_120_0.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\nvrtc-builtins64_120.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\OpenEXR-3_1.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\osdCPU.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\partio.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\pcre2-16.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\qt.conf"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\Qt5Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\Qt5Gui.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\Qt5Network.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\Qt5OpenGL.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\Qt5Svg.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\Qt5Widgets.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\tbb.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\URDFImporter.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\VHACD.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\xatlasUVCore.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zeno.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zeno.dll.manifest"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zeno.exp"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zeno.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zenoedit.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zenoedit.exe.manifest"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\ZFX.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zpc.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zpccore.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zpccuda.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zpcomp.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zpctool.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zspartio.lib"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\zstd.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\logo.ico"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\plugins\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”

[Registry]
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""

;[Icons]
;Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
;Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";Tasks: desktopicon

[Icons]
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; IconFilename:"{app}\logo.ico"
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";
Name: "{group}\卸载{#MyAppName}"; Filename: "{uninstallexe}"

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

三 错误解决

3.1 另一个程序正在使用此文件,进程无法访问

解决方法:

建立一个小的程序,多运行几次,没有这个错误后,再编译目标大程序。

或者电脑注销后再登录电脑,重新编译。

3.2 桌面图标无法修改

解决方法:

加载图标到inno

Source: "C:\Users\pgjgg\Desktop\work\202302\zeno\zeno-2023-0215-122452-nt\bin\logo.ico"; DestDir: "{app}"; Flags: ignoreversion

然后添加如下行:

[Icons]
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; IconFilename:"{app}\logo.ico"

四 参考资料

把.Net依赖打进安装包中 (3)_哔哩哔哩_bilibili

【1、Inno Setup打包工具能打包超过8G的文件吗?】
感谢观众@嗨呀好气的大星 提供的解决办法:
inno 磁盘跨越必须启用,因为程序大于21000000000。
解决办法是在【Setup】这一栏的末尾添加 DiskSpanning=yes;
【2、打包文件到动态路径下 代码如何搞,例如c:\user\电脑用户名\local\file就是每台电脑的用户名不一样不知道如何搞】
官方文档中,有相关的说明,我总结了一下大概是:
如果你想要取到“C:\Users\用户名\AppData\Roaming\AAAAA” ,写法是{userappdata}\AAAAA
如果你想要取到“用户桌面\AAAAA”文件夹,写法是{userdesktop}\AAAAA
如果我们写{sd}/Users/{username}/xxx,那么这样就获取到了“C:/用户/用户名/xxx/”这个文件夹
(其中{sd}指的是系统盘,{username}指的是用户名)

Inno Setup官网:

https://jrsoftware.org/isinfo.php

界面汉化包地址:

https://jrsoftware.org/files/istrans/

如果上面那个汉化包地址不能用的话:

https://github.com/kira-96/Inno-Setup-Chinese-Simplified-Translation

【相关文章(在最后一个视频里,有详细说明)】

相关的文章推荐_哔哩哔哩_bilibili
Inno Setup 快速打包应用程序 简单 软件打包发行的使用说明:https://blog.csdn.net/linbounconstraint/article/details/48652839

Inno setup 入门:

https://blog.csdn.net/qq\_37518975/article/details/102888012

innosetup 教程【2】如何通过【code】字段自定义安装界面:http://www.360doc.com/content/17/0323/23/26636126\_639606227.shtml

用 Inno Setup 来解决.NetFramework 安装问题:

https://blog.51cto.com/zhoufoxcn/279243

相关文章
|
编译器 C# Windows
Inno Setup制作安装包教程
Inno Setup制作安装包教程
983 0
|
Unix C#
使用Inno Setup 制作软件安装包详细教程(与开发语言无关)
前言:关于如何制作一个软件安装包的教程,与编程语言无关。以下,请看详情~
825 0
使用Inno Setup 制作软件安装包详细教程(与开发语言无关)
制作部署安装包:Inno Setup
原文:制作部署安装包:Inno Setup 前一篇尝试Office 2003 VSTO的开发、部署有提到用VS开发一个简单的VSTO程序。打包C/S程序,我首先想到的是VS里自带的Setup Project。
1344 0
|
Windows
NSIS 打包脚本基础
简介 NSIS(Nullsoft Scriptable Install System)是一个开源的 Windows 系统下安装程序制作程序。它提供了安装、卸载、系统设置、文件解压缩等功能。这如其名字所指出的那样,NSIS 是通过它的脚本语言来描述安装程序的行为和逻辑的。
1689 0
一个比较完整的Inno Setup 安装脚本
原文:一个比较完整的Inno Setup 安装脚本 增加了对ini文件设置的功能,一个安装包常用的功能都具备了。 [Setup]; 注: AppId的值为单独标识该应用程序。; 不要为其他安装程序使用相同的AppId值。
1636 0
|
关系型数据库 Java 应用服务中间件
用inno Setup制作web项目安装包
原文:用inno Setup制作web项目安装包 用inno Setup制作安装包 新建一个文件夹exambody,放apache-tomcat-6.0.33、mysql-5.1.37-win32、java(注:jdk)和图标exambody.
1287 0
|
SQL .NET 数据库
用Inno Setup制作WEB程序安装包
原文 用Inno Setup制作WEB程序安装包 最近做了一个WEB程序的安装包,我把制作的过程做个介绍,贴出源码给大家做个参考看看inno 的脚本     [Setup] AppCopyright=test AppName=test AppVerName=test v2.
1185 0