AWAurora233
修好了
.iss文件
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
; Non-commercial use only.
#define MyAppName "ClassIsland"
#define MyAppVersion "2.1.0.1"
#define MyAppPublisher "ClassIsland,HelloWRC"
#define MyAppURL "https://www.classisland.tech/"
#define MyAppExeName "ClassIsland.exe"
#define DoubleAmp(Value) StringChange(Value, "&", "&&")
#define EscapeConstArgument(Value) StringChange(StringChange(StringChange(Value, "%", "%25"), ",", "%2c"), "}", "%7d")
[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={{A7190162-367C-4A87-9799-40AAD691BF27}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={cm:NameAndVersion,{#EscapeConstArgument(MyAppName)},{#EscapeConstArgument(MyAppVersion)}}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run on anything but x64 and Windows 11 on Arm.
ArchitecturesAllowed=x64compatible
; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the install be done in "64-bit mode" on x64 or Windows 11 on Arm.
; This means it should use the native 64-bit Program Files directory and the 64-bit view of the registry.
ArchitecturesInstallIn64BitMode=x64compatible
; Uncomment the following line to use a 64-bit installer.
;SetupArchitecture=x64
DisableProgramGroupPage=yes
LicenseFile=D:\Program Files (x86)\ClassIsland_app_windows_x64_full_folder\app-2.1.0.1-0\Assets\LICENSE.txt
InfoBeforeFile=D:\Program Files (x86)\ClassIsland_app_windows_x64_full_folder\others\before installation.txt
; Uncomment the following line to run in non administrative install mode (install for current user only).
;PrivilegesRequired=lowest
OutputDir=D:\Program Files (x86)\ClassIsland files app
OutputBaseFilename=课表岛(ClassIsland)-v2.1.0.1-x64
SetupIconFile=D:\Program Files (x86)\ClassIsland_app_windows_x64_full_folder\others\favicon.ico
SolidCompression=yes
WizardStyle=modern dynamic
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "Install_NET";Description:"安装.NET 8.0 桌面运行时 (8.0.31)"; GroupDescription: "运行环境:"; Flags: checkedonce
[Files]
Source: "D:\Program Files (x86)\ClassIsland_app_windows_x64_full_folder\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\Program Files (x86)\ClassIsland_app_windows_x64_full_folder\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files.
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
; 安装 .NET 8.0 桌面运行时(仅当用户勾选了 Install_NET 任务时执行)
Filename: "{app}\windowsdesktop-runtime-8.0.31-win-x64.exe"; Parameters: "/install /quiet /norestart"; StatusMsg: "正在安装 .NET 8.0 桌面运行时..."; Tasks: Install_NET; Flags: waituntilterminated
; 安装完成后启动主程序
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#DoubleAmp(MyAppName)}}"; Flags: nowait postinstall skipifsilent
[Code]
// 结束指定进程的通用函数
procedure TaskKill(FileName: String);
var
ResultCode: Integer;
begin
Exec(ExpandConstant('{sys}\taskkill.exe'), '/f /t /im "' + FileName + '"', '',
SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
// 安装阶段:在开始复制文件前结束正在运行的主程序
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
TaskKill('{#MyAppExeName}');
end;
end;
// 卸载阶段:先结束进程,再询问是否删除用户配置
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then
begin
TaskKill('{#MyAppExeName}');
if MsgBox('您是否要删除用户配置信息?', mbConfirmation, MB_YESNO) = IDYES then
begin
// 删除用户配置目录(根据实际情况修改路径)//这里删了全部文件
DelTree(ExpandConstant('{app}'), True, True, True);
end;
end;
end;
1312333/ClassIslandreleases/tag/2.1.0.1