我正在使用 Inno setup 构建我的应用程序的安装程序。但我遇到的问题是 installer.exe 没有任何图标(使用默认值),即使我使用 SetupIconFile 指定了一个图标。这是完整的脚本:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "TFGplay"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "TFGPlayCompany"
#define MyAppExeName "05TFGPlay-0.0.1-SNAPSHOT.jar"
[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={{2733F2A1-246B-4D80-8EE4-B37B2BADFD87}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
; Donde instalar x defecto
DefaultDirName={autopf}\TFGPlay
DefaultGroupName={#MyAppName}
; Not show select start menu folder. We wont create a start menu folder
DisableProgramGroupPage=yes
AllowNoIcons=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
; Change this if you want the exe to install in other folder. By default it will be installed in the same folder as the script
OutputDir={#SourcePath}
; Name of the installer
OutputBaseFilename=TFGPlay-installer
; Icon for the .exe and the whole process. Descomentar si conseguimos un logo
SetupIconFile="C:\Users\test\Downloads\descarga.ico"
; https://stackoverflow.com/questions/20792468/inno-setup-installer-icon-does-not-show-in-control-panel-or-settings.
UninstallDisplayIcon="C:\Users\test\Downloads\descarga.ico"
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
[Files]
Source: "C:\Users\miro\Desktop\TFGPlay\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
; falta añdir el IconFilename despues del filename
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "C:\Users\test\Downloads\descarga.ico"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent unchecked
我还想补充一点,我之前已经创建了一个安装程序,图标正确显示。这是供参考的脚本:
; You will need Inno Setup to run this script -> https://jrsoftware.org/isdl.php#stable
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Parrot"
; Change version accordingly
#define MyAppVersion "1.0"
#define MyAppPublisher "MIRO"
#define MyAppURL "https://gitlab.com/ai4miro/parrot"
; Main file to execute
#define MyAppExeName "Start_PARROT.bat"
[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={{60CAC044-CFF7-4422-88EF-4D06067CFC6C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
; Not show select start menu folder. We wont create a start menu folder
DisableProgramGroupPage=yes
AllowNoIcons=yes
; License of the App
LicenseFile={#SourcePath}\..\dist\parrot-app\License
; Uncomment the following line to run in non administrative install mode (install for current user only.)
; PrivilegesRequired=lowest
; Name of the installer
OutputBaseFilename=Parrot-installer
; Change this if you want the exe to install in other folder. By default it will be installed in the same folder as the script
OutputDir={#SourcePath}
; Icon for the .exe and the whole process.
SetupIconFile={#SourcePath}\..\platform\viewer\public\assets\favicon.ico
; https://stackoverflow.com/questions/20792468/inno-setup-installer-icon-does-not-show-in-control-panel-or-settings
UninstallDisplayIcon={#SourcePath}\..\platform\viewer\public\assets\favicon.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
[Files]
Source: "..\dist\parrot-app\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
; Not needed but left for possible future changes (create start menu folder)
; Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
; Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
; Desktop Icon: https://stackoverflow.com/questions/32262254/how-to-create-a-desktop-icon-with-inno-setup
; if we want to make sure it is installed on the userDesktop instead of autoDesktop put userdesktop.
; right now will install in commondesktop if it is run in administrative -> https://jrsoftware.org/ishelp/index.php?topic=consts
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{#SourcePath}\..\platform\viewer\public\assets\favicon.ico"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent
正如 Martin Prikryl 在帖子评论中所说,图标似乎已被缓存,即使图标没问题……它仍然显示“旧”图标。我处理这个问题的方法是更改安装程序的名称,它工作正常。
重要提示:您不应使用桌面作为编译器输出。
PS:您可以清除图标缓存,但对我不起作用