[Tool]Inno Setup创建软件安装程序。

这篇博客将介绍如何使用Inno Setup创建一个软件安装程序。

Inno Setup官网:http://www.jrsoftware.org/isinfo.php。 可以下载到最新的Inno Setup,目前最新的版本5.5.9. Inno Setup的安装程序支持非常广泛,从Windows 2000到Windows 10都支持。目前的版本中没有官方出品的中文语言包,不过国内有开发者提供了中文的语言包,请参考:http://www.cnblogs.com/shiningrise/p/5662249.html

将下载好的语言包,放置在Inno Setup安装目录Languages文件夹下即可。

下面是一个Inno Setup制作的安装包脚本,

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

#define MyAppName "Smart NST"
#define MyAppVersion "1.0"
#define MyAppPublisher "NST.inc"
#define MyAppURL "http://www.nst.com"
#define MyAppExeName "Aries.Presentation.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={{26AEFF50-EC0D-4EBE-A2E4-12184EAF1DED}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
InfoBeforeFile=C:\Users\V-CHENFY\Desktop\init.rtf
OutputDir=C:\Users\V-CHENFY\Desktop\
OutputBaseFilename=NST
SetupIconFile=D:\Development\NST\Libs\NST.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "chinese"; MessagesFile: "compiler:Languages\Chinese.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "C:\Users\V-CHENFY\Desktop\Base\Aries.Presentation.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\V-CHENFY\Desktop\Base\Aries.Common.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\V-CHENFY\Desktop\Base\Aries.Framework.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\V-CHENFY\Desktop\Base\Aries.Presentation.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\V-CHENFY\Desktop\Base\Aries.Presentation.exe.config"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\V-CHENFY\Desktop\Base\MahApps.Metro.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\V-CHENFY\Desktop\Base\System.Windows.Interactivity.dll"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon

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

注意最后加粗的shellexec,当需要执行的程序是需要管理员权限时,记得一定要加上这个命令。

posted @ 2016-12-22 16:53  Yang-Fei  阅读(309)  评论(0编辑  收藏  举报