前面在使用到Inno Setup打包exe安装应用的时候,安装后发现在控制面板中应用对应的图标缺失
想了想在打包安装阶段应该不是代码程序的问题,可能是Inno Setup自身打包的时候缺少了配置,在官方查看API的时候发现了这个属性:
UninstallDisplayIcon={app}\icon.ico
字面意思就是卸载时显示的图标,那就是控制面板中卸载程序的时候所要显示的图标。这里的app指的是你项目安装后的根目录,一般可以在electron 编译之后的build目录下所编译的文件夹的根目录下存放一张图片,以便用于引用。如下图所示,1为执行npm run build 后根据系统生成的文件目录即打包exe所需要的的根目录,2为我在卸载面板中所引用的图片路径。
打开通过Inno Setup的配置文件.iss文件,在【setup】中添加这个配置
[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={{FB4E9769-4EFF-414E-AA0A-69BC74C2F121}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputDir=D:\setup
OutputBaseFilename=DynaroseEdgeClient
SetupIconFile=D:\icon.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
UninstallDisplayIcon={app}\icon.ico
然后再打包项目,安装后可以在控制面板中,看到程序图标
另外,还要另外两个配置参数,可以配合使用
//设置控制面板中程序的名称
Uninstallable=yes
UninstallDisplayName={#MyAppName}