目录

一  打包结果

二 示例打包脚本

三 错误解决

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

3.2 桌面图标无法修改

四 参考资料


一  打包结果

inno setup打包软件学习_#define

二 示例打包脚本

使用打包软件下载地址:

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 另一个程序正在使用此文件,进程无法访问

inno setup打包软件学习_ico_02

解决方法:

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

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

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"

四 参考资料

【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}指的是用户名)