79 lines
3.3 KiB
Plaintext
79 lines
3.3 KiB
Plaintext
|
|
; Inno Setup 6 安装脚本 — 用法见同目录 build-installer.ps1
|
|||
|
|
; 需先安装: https://jrsoftware.org/isdl.php
|
|||
|
|
|
|||
|
|
#define MyAppName "智能制造MES工控"
|
|||
|
|
#define MyAppExeName "YY.Admin.exe"
|
|||
|
|
#define MyAppVersion "1.1.0"
|
|||
|
|
#define MyPublisher "星数连科技科技有限公司"
|
|||
|
|
; 相对本 .iss 文件位置(installer\ 下的上一级为 yy-admin-master)
|
|||
|
|
#define PublishRoot "..\YY.Admin\bin\Release\net8.0-windows10.0.19041\win-x64\publish"
|
|||
|
|
|
|||
|
|
[Setup]
|
|||
|
|
AppId={{B7E8F4A2-9C1D-4E6F-8A3B-2D5E9C1F4A7B}
|
|||
|
|
AppName={#MyAppName}
|
|||
|
|
AppVersion={#MyAppVersion}
|
|||
|
|
AppPublisher={#MyPublisher}
|
|||
|
|
AppPublisherURL=https://www.example.com/
|
|||
|
|
DefaultDirName={autopf}\{#MyPublisher}\{#MyAppName}
|
|||
|
|
DefaultGroupName={#MyAppName}
|
|||
|
|
AllowNoIcons=yes
|
|||
|
|
OutputDir=..\_installer_output
|
|||
|
|
OutputBaseFilename=YY.Admin_Setup_{#MyAppVersion}_win-x64
|
|||
|
|
Compression=lzma2/max
|
|||
|
|
SolidCompression=yes
|
|||
|
|
WizardStyle=modern
|
|||
|
|
PrivilegesRequired=admin
|
|||
|
|
ArchitecturesAllowed=x64compatible
|
|||
|
|
ArchitecturesInstallIn64BitMode=x64compatible
|
|||
|
|
MinVersion=10.0.17763
|
|||
|
|
DisableProgramGroupPage=no
|
|||
|
|
DisableDirPage=no
|
|||
|
|
UninstallDisplayIcon={app}\{#MyAppExeName}
|
|||
|
|
SetupLogging=yes
|
|||
|
|
|
|||
|
|
; 向导语言:使用 Inno 自带的 Default.isl(英文)。若本机存在 Languages\ChineseSimplified.isl,
|
|||
|
|
; 可改为: Name: "chinesesimp"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
|
|||
|
|
[Languages]
|
|||
|
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
|||
|
|
|
|||
|
|
[Tasks]
|
|||
|
|
Name: "desktopicon"; Description: "在桌面创建快捷方式"; GroupDescription: "附加图标:"; Flags: unchecked
|
|||
|
|
Name: "installwebview2"; Description: "安装 Microsoft Edge WebView2 运行时(内嵌网页需要;若已安装会自动跳过)"; GroupDescription: "运行环境:"; Flags: checkedonce
|
|||
|
|
|
|||
|
|
[Files]
|
|||
|
|
; 发布目录完整拷贝(含 Configuration、Updates 等)
|
|||
|
|
Source: "{#PublishRoot}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|||
|
|
; WebView2 引导安装包(由 build-installer.ps1 下载到 redist;编译时若无文件可加 Flags skipifsourcedoesntexist)
|
|||
|
|
Source: "redist\MicrosoftEdgeWebview2Setup.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall skipifsourcedoesntexist
|
|||
|
|
|
|||
|
|
[Icons]
|
|||
|
|
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; WorkingDir: "{app}"
|
|||
|
|
Name: "{group}\卸载 {#MyAppName}"; Filename: "{uninstallexe}"
|
|||
|
|
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; WorkingDir: "{app}"; Tasks: desktopicon
|
|||
|
|
|
|||
|
|
[Run]
|
|||
|
|
Filename: "{tmp}\MicrosoftEdgeWebview2Setup.exe"; Parameters: "/silent /install"; StatusMsg: "正在安装 WebView2 运行时..."; Flags: waituntilterminated; Tasks: installwebview2; Check: ShouldInstallWebView2()
|
|||
|
|
|
|||
|
|
Filename: "{app}\{#MyAppExeName}"; Description: "启动 {#MyAppName}"; Flags: nowait postinstall skipifsilent
|
|||
|
|
|
|||
|
|
[Code]
|
|||
|
|
|
|||
|
|
// 安装包是否携带了 WebView2 引导程序(已释放到临时目录)
|
|||
|
|
function WebView2BootstrapInTmp: Boolean;
|
|||
|
|
begin
|
|||
|
|
Result := FileExists(ExpandConstant('{tmp}\MicrosoftEdgeWebview2Setup.exe'));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// Evergreen WebView2 是否存在(注册表中存在版本号则认为已装)
|
|||
|
|
function WebView2RuntimeInstalled: Boolean;
|
|||
|
|
var
|
|||
|
|
Ver: String;
|
|||
|
|
begin
|
|||
|
|
Result := RegQueryStringValue(HKLM, 'SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}', 'pv', Ver) and (Trim(Ver) <> '');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function ShouldInstallWebView2: Boolean;
|
|||
|
|
begin
|
|||
|
|
Result := WebView2BootstrapInTmp and (not WebView2RuntimeInstalled);
|
|||
|
|
end;
|