Files
qhmes/yy-admin-master/installer/YY.Admin.Setup.iss
2026-05-19 14:13:32 +08:00

80 lines
3.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
; Inno Setup 6 安装脚本 — 用法见同目录 build-installer.ps1
; 需先安装: https://jrsoftware.org/isdl.php
#define MyAppName "智能制造MES工控"
#define MyAppExeName "YY.Admin.exe"
#define MyAppVersion "1.1.4"
#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
; 客户工控机常见 Win Server 201610.0.14393);调试目录直拷可运行,仅安装器原 17763 门槛过严
MinVersion=10.0.14393
DisableProgramGroupPage=no
DisableDirPage=no
UninstallDisplayIcon={app}\{#MyAppExeName}
SetupLogging=yes
; 向导语言:默认简体中文;语言文件与本 .iss 同目录ChineseSimplified.isl无需复制到 Inno 目录
[Languages]
Name: "chinesesimplified"; MessagesFile: "ChineseSimplified.isl"
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;