第一步
QT程序写好之后,编译release版本
第二步
拿到release生成的.exe文件
第三步
新建文件夹deploy
第四步
将.exe文件复制到deploy目录下
第五步
在该目录下输入cmd指令,回车
第六步
在打开的命令窗口下输入 windeployqt TegNetCom_1.0.0.exe命令
会自动将你这个qt程序所需要到的库带到deploy这个目录下,在这个目录下就是你所要发布的程序以及所有的库。
第七步
安装制作安装包的软件下载地址 正常下载安装即可。
第八步
打开inno Setup Compiler 。选择File -》new-》Next
第九步
填写应用程序名称,应用程序版本,应用程序发布者,应用程序网站,前两个是必填项。然后Next
第十步
填写安装时默认的路径及文件名,然后Next
第十一步
选择应用程序的主执行文件,也就是第二步中拿到的.exe文件。点击下方Add folder,把这个程序运行所需要的dll和资源放在一个文件夹中,我这里就是deploy文件夹。然后Next
第十二步
接着再次点击Next,来到下一个页面。输入开始菜单中显示的名字,Next
第十三步
这里选择许可文件,安装前的文件,安装后显示信息,我这里先没有填,然后Next
第十四步
再次点击Next,直到来到选择语言页面,Next
第十五步
选择自定义编译器输出文件夹,编译器输出基本文件名,自定义的安装程序图标文件,安装密码。Next
第十六步
一路Next直到结束,将文件保存一下,之后就可以修改这个文件然后编译再次生成安装包TegNetComInno.iss
生成的iss文件
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!#define MyAppName "TegNetCom"
#define MyAppVersion "2.0"
#define MyAppExeName "TegNetCom_2.0.0.exe"
#define MyAppAssocName MyAppName + " File"
#define MyAppAssocExt ".myp"
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{ED354006-ACB2-4454-8951-D733CBD30D92}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName=C:/Program Files (x86)/TegNetCom\{#MyAppName}
ChangesAssociations=yes
DefaultGroupName={#MyAppName}
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputDir=D:\work_qt_project\EthernetOverCANConfig\install
OutputBaseFilename=TegNetCom_2.0.0_x86_Setup
SetupIconFile=D:\work_qt_project\EthernetOverCANConfig\Resource\main.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked[Files]
Source: "D:\work_qt_project\EthernetOverCANConfig\deploy\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\work_qt_project\EthernetOverCANConfig\deploy\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files[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: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
再次编译生成安装包
修改程序之后点击图中按钮会再次生成安装包