溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

C/S軟件打包部署神器InnoSetup怎么用

發(fā)布時(shí)間:2022-01-17 11:07:09 來(lái)源:億速云 閱讀:125 作者:柒染 欄目:系統(tǒng)運(yùn)維

C/S軟件打包部署神器InnoSetup怎么用,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。

概述

我們都知道做客戶端軟件,一般交付給客戶的都是exe的安裝包。那么我們平常開發(fā)完成之后,如何把程序進(jìn)行打包呢。找了下發(fā)現(xiàn)Inno  Setup是個(gè)不錯(cuò)的選擇。

InnoSetup 是一個(gè)免費(fèi)的 Windows 安裝程序制作軟件。第一次發(fā)表是在 1997 年,Inno Setup  今天在功能設(shè)置和穩(wěn)定性上的競(jìng)爭(zhēng)力可能已經(jīng)超過(guò)一些商業(yè)的安裝程序制作軟件。

能做什么

1.支持現(xiàn)在所有正在使用的 Windows 版本: 7, 2008 R2, Vista, XP, 2008,2003, 2000, Me,  98, 95, 和 NT 4.0 (不需要服務(wù)包)。

2.廣泛支持在 64 位 的 Windows XP and Windows Server2003 版本的操作系統(tǒng)中的 64 位應(yīng)用程序安裝。支持 x64  和 Itanium 兩個(gè)結(jié)構(gòu)。(在 Itanium 結(jié)構(gòu)中,必須在 64 位模式安裝 Service Pack 1。)

3.支持創(chuàng)建單個(gè)EXE 格式的安裝程序,使你的程序可以很方便地在網(wǎng)絡(luò)上發(fā)表。同時(shí)也支持磁盤延伸。

4.標(biāo)準(zhǔn)的Windows 2000/XP 樣式向?qū)Ы缑妗?/p>

5.定制安裝類型,例如:完整安裝,最小安裝,自定義安裝。

6.完整的卸載功能。

7.文件安裝:

包括完全的“壓縮”支持,bzip2 和 7-Zip LZMA  文件壓縮。安裝程序可以比較文件版本信息,替換正在使用的文件,使用共享文件計(jì)數(shù),注冊(cè)DLL/OCX 和類型庫(kù),以及安裝字體。

8.可以在任意地方創(chuàng)建快捷方式,包括開始菜單和桌面。

9.創(chuàng)建注冊(cè)表 和.INI 條目。

10.在安裝之前、之中或之后可運(yùn)行其他程序。

11.支持多語(yǔ)言安裝。

12.支持密碼和加密安裝。

13.支持?jǐn)?shù)字簽名 、安裝和卸載。

14.后臺(tái)安裝和后臺(tái)卸載。

15.Unicode安裝。(Windows 2000/XP 或更高)

16.完整的Pascal 腳本 引擎選項(xiàng)于運(yùn)行期高級(jí)自定義安裝和卸載。

17.全部源代碼公開(Borland Delphi 2.0-5.0 和 2009)。

創(chuàng)建安裝程序的方式:腳本

安裝程序用編譯腳本的方式創(chuàng)建,腳本其實(shí)就是一個(gè)類似.INI 文件格式的 ASCII  碼文本文件。(它不象你想象的那么復(fù)雜!)。Unicode Inno Setup支持 UTF-8 編碼文本文件。

腳本用一個(gè)“.iss”(表示 Inno Setup Script腳本)  的擴(kuò)展名。腳本控制著安裝程序的所有方面。由它指定哪些文件將被安裝到什么地方,在哪里創(chuàng)建快捷方式,且被命名為什么。

腳本文件一般可以用安裝程序編譯器程序內(nèi)置的編輯器進(jìn)行編輯。在你編寫完腳本后,下一個(gè)最終步驟就是選擇安裝程序編譯器中的“編譯”。創(chuàng)建完成后,就可以運(yùn)行根據(jù)你腳本編譯的安裝程序了。按默認(rèn),這個(gè)安裝程序創(chuàng)建在包含腳本文件目錄下的名為“輸出”目錄中。

如果你想看看它是怎樣工作的,啟動(dòng)安裝程序編譯器,單擊“文件 | 打開”,并選擇位于 Inno Setup 安裝目錄下的Examples  子目錄中的一個(gè)腳本文件。(你也可以將這些示例腳本作為你自己編寫腳本的模板。)

以下是我之前的項(xiàng)目的腳本

; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!  #define MyAppName "主機(jī)助手" #define MyAppVersion "1.1.1.7" #define MyAppPublisher "點(diǎn)擊網(wǎng)絡(luò), 技術(shù)部." #define MyAppURL "http://yroot.bidns.net/" #define MyAppExeName "主機(jī)助手.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={{CD9818E0-FEE2-418E-9775-15F50AE2229E} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\ZhugAssistant DisableProgramGroupPage=yes OutputDir=C:\Users\admin\Desktop OutputBaseFilename=主機(jī)助手安裝包 SetupIconFile=C:\Users\admin\Documents\Visual Studio 2010\Projects\yroot-10-24\yroot\bin\Debug\images\title.ico Compression=lzma SolidCompression=yes  [Languages] Name: "english"; MessagesFile: "compiler:Default.isl"  [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: exclusive Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked    [Files] Source: "D:\Debug\主機(jī)助手.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\AccessSetup.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\conf\*"; DestDir: "{app}\conf\"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "D:\Debug\data\*"; DestDir: "{app}\data\"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "D:\Debug\images\*"; DestDir: "{app}\images\"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "D:\Debug\tools\*"; DestDir: "{app}\tools\"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "D:\Debug\CSkin.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\DiskQuotaTypeLibrary.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\DMSkin.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\form_data_path.txt"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\Interop.ADODB.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\Interop.ADOX.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\Interop.FsrmLib.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\Interop.IISOle.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\Interop.TaskScheduler.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\MetroFramework.Design.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\MetroFramework.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\MetroFramework.Fonts.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\Microsoft.Web.Administration.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\Microsoft.Win32.TaskScheduler.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\MySql.Data.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\SimpleUpdater.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\yroot.vshost.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\yroot.vshost.exe.config"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\yroot.vshost.exe.manifest"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\yroot_beta.vshost.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\yroot_beta.vshost.exe.config"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\yroot_beta.vshost.exe.manifest"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\主機(jī)助手.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\主機(jī)助手.exe.config"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\Debug\主機(jī)助手.pdb"; DestDir: "{app}"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files  [Icons] Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon Name: "{group}\{cm:UninstallProgram,主機(jī)助手}"; Filename: "{uninstallexe}"    ;[Components]   ;Name: Access; Description: "Access支持" ; Types: Full    [Messages]    ;卸載對(duì)話框說(shuō)明   ConfirmUninstall=您真的想要從電腦中卸載主機(jī)助手嗎?%n%n按 [是] 將會(huì)刪除 %1 以及它的組件;%n按 [否] 則讓軟件繼續(xù)留在您的電腦上.    [Run] Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent  [Registry]   Root: HKLM ;SubKey:"Software\ZhugAssistant";ValueType:dword;ValueName:config;ValueData:10 ;Flags: uninsdeletekey  [code] //init setup function InitializeSetup(): boolean;   //var var Istoken: boolean; //avoid setup again    begin        Istoken := true;         if RegValueExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\ZhugAssistant', 'config') then   begin       MsgBox('程序已安裝,請(qǐng)卸載后再嘗試安裝!',mbConfirmation, MB_OK);       Istoken := false;   end else   begin        Istoken := true;   end;   Result := Istoken;   end;  //next button function NextButtonClick(CurPageID: Integer): Boolean;   //var var ResultCode: Integer;   var IsSetup : Boolean;   begin   IsSetup := true ;   case CurPageID of       wpReady:         begin          if not RegValueExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\CLSID\{6F3DD387-5AF2-492B-BDE2-30FF2F451241}\InprocServer32\12.0.0.0', 'RuntimeVersion') then   begin             if MsgBox('程序執(zhí)行需要Access數(shù)據(jù)庫(kù)的支持,是否現(xiàn)在安裝?', mbConfirmation, MB_YESNO) = idYes then begin              ExtractTemporaryFile('AccessSetup.exe');    ExtractTemporaryFile('DMSkin.dll');             if not Exec(ExpandConstant('{tmp}\AccessSetup.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode) then                 MsgBox('Access安裝出錯(cuò):' #13#13 ' ' + SysErrorMessage(ResultCode) + '.', mbError, MB_OK);             end else begin                   IsSetup := false ;             end ;             BringToFrontAndRestore();           end;         end;   end;   Result := IsSetup;   end;

C/S軟件打包部署神器InnoSetup怎么用

看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝您對(duì)億速云的支持。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI