使用Inno Setup Compiler制作安裝軟件包


前言

項目開發完成之后,需要程序打包發行,本文使用Inno Setup工具制作安裝軟件包。

系統環境

系統:win7_x64

工具:Inno Setup Complier

實現步驟

1.下載安裝Inno Setup打包工具;

2.使用Inno Setup工具打包應用程序;

3.腳本程序;

實現過程

1.下載安裝Inno Setup打包工具

1)度娘;

2)官網

2.使用Inno Setup工具打包應用程序

1)打開Inno Setup Complier,新建一個腳本向導程序;

2)點擊下一步,在應用程序信息中輸入產品的名稱、版本號、發行單位、公司網址等,這些信息會自動在腳本中生成;

3)點擊下一步,自定義打包文件的的輸出地址以及輸出文件夾的名稱;

4)點擊下一步,選擇應用程序主要的可執行文件,添加其它必需用到的文件或者文件夾;

注意:整個安裝包需要包含的文件必須全部包含在內;

5)點擊下一步,輸入應用程序在開始菜單中顯示的名字;

6)下一步,選擇安裝時需要顯示的信息、安裝語言、安裝名稱等;

  

7)下一步,選擇編譯程序輸出文件夾、文件名稱、ICON文件及安裝密碼;

注意:第一個選項表示的是安裝包*.exe輸出的目錄;

8)下一步,打包完成;

   

3.腳本程序

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "紅牌檢測系統"
#define MyAppVersion "2.5"
#define MyAppPublisher "SHIOTC, Inc."
#define MyAppURL "http://www.shiotc.com/"
#define MyAppExeName "redplate_qt.exe"

[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={{D21B4F6B-401E-4575-B6E1-612A9CA50D58}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName=D:/redplate_detection_v2.5
DefaultGroupName=redplate_detection_v2.5
OutputDir=E:\carriage_recognition\redplate_detection\qt\redplate_qt_svm2\x64\Release
OutputBaseFilename=redplate_detection_2.5
;SetupIconFile=E:\carriage_recognition\redplate_detection\qt\redplate_qt_svm2\x64\Release\ICON.ico
Password=123456
Compression=lzma
SolidCompression=yes

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

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

[Files]
Source: "E:\carriage_recognition\redplate_detection\qt\redplate_qt_svm2\x64\Release\redplate_qt.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\carriage_recognition\redplate_detection\qt\redplate_qt_svm2\x64\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

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

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

可以直接保存應用程序,這樣再次打包可以直接運行打包程序進行;另外,運行過程中出現錯誤,可以直接在腳本中進行修改;

問題

1.使用自定義的圖標,腳本語句如下,出現下圖所示的錯誤,將*.png文件更改為*.ico文件,仍然出錯,可能需要使用ico文件生成工具生成*.ico文件;

SetupIconFile=E:\carriage_recognition\redplate_detection\qt\redplate_qt_svm2\x64\Release\ICON.ico 

 

參考

1.Inno打包教程

2.CSDN大神博客


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM