添加/删除程序中的 Wix 图标 [英] Wix icon in Add/Remove programs
问题描述
我正在使用 Wix 创建我的安装程序.根据官方文档,如果我想更改添加/删除程序中的图标,我需要添加:
I am using Wix to create my installer. According to the official documentation, if I want to change the icon in Add/Remove Programs, I need to add this:
<Icon Id="icon.ico" SourceFile="MySourceFiles\icon.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
但它不起作用,图标没有改变,我也收到以下警告:
But it does not works, the icon is not changed and I also get the following warning:
C:\Users\rsheink\home\repos\tenlira\10Lira\TestWiXProject\Product.wxs(137,0):警告 LGHT1076:ICE36:图标膨胀.图标中未使用 icon.ico类、快捷方式或 ProgID 表,也不用于 ARPPRODUCTICON财产.
C:\Users\rsheink\home\repos\tenlira\10Lira\TestWiXProject\Product.wxs(137,0): warning LGHT1076: ICE36: Icon Bloat. Icon icon.ico is not used in the Class, Shortcut, or ProgID table and also not used for ARPPRODUCTICON property.
请问我遗漏了什么?
谢谢.Refael.
根据@harper 的出色建议,这里是 MCVE:
Following the excelent advice from @harper, here is the MCVE:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:difx="http://schemas.microsoft.com/wix/DifxAppExtension">
<Product Id="*" Codepage="1252" Language="1033" Manufacturer="Intel Corporation"
Name="TenLira" UpgradeCode="PUT-GUID-HERE" Version="31.00.0000">
<Package Comments="Contact: Your local administrator" Description="TenLira" InstallerVersion="500"
Compressed="yes"
InstallScope="perMachine"
Keywords="Installer,MSI,Database" Languages="1033" Manufacturer="Intel Corporation" Platform="x64" />
<Media Id="1" Cabinet="my_application.cab" EmbedCab="yes" />
<MajorUpgrade AllowDowngrades="no"
AllowSameVersionUpgrades="no"
Disallow="no"
IgnoreRemoveFailure="no"
MigrateFeatures="yes"
Schedule="afterInstallInitialize"
DowngradeErrorMessage="A later version of [ProductName] is already installed" />
<Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONROOTDIRECTORY" />
<UIRef Id="WixUI_InstallDir" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="PROGRAMFILESSUBDIR" Name="Intel Corporation">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="TenLira">
<Directory Id="kmgl" Name="kmgl">
<Directory Id="kmgl_win10" Name="kmgl_win10" />
</Directory>
<Directory Id="tools" Name="tools" />
</Directory>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="tools">
<Component Id="devcon.exe" Guid="*">
<File Id="devcon.exe" Source="..\tools\devcon\amd64\devcon.exe" KeyPath="yes" />
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="TenLira" Level="1">
<ComponentRef Id="devcon.exe" />
</Feature>
<!--It should set the icon in Add/Remove programs, but it does not works and I don't know why.-->
<Icon Id="icon.ico" SourceFile="..\TenLira icons\coins\coins.ico" />
<Property Id="ARPPRODUCTION" Value="icon.ico" />
</Product>
</Wix>
推荐答案
Request:请评论以下任何一项是否适合您 - 以及您是否做了某事否则(也)使事情正常进行.
Request: Please comment if any of the below works for you - and also if you did something else (as well) to get things working.
快速列表优先:
ARPPRODUCTICON
是否拼写正确?File.ico
文件是否有隐藏的文件扩展名?示例:icon.ico.bmp
- 1.在 Windows 资源管理器中显示文件扩展名
- 在文件夹中打开一个
cmd.exe
并做一个目录来检查?
- 这是一个正确的 *.ico 文件吗?尝试保存普通的 *.bmp 并将扩展名重命名为 *.ico.这应该适用于基本的测试图标.
- 找一个合适的模板 *.ico 文件进行测试(应该有很多在 Visual Studio 安装文件夹中).
更新:
请尝试更改此设置:
<Property Id="ARPPRODUCTION" Value="icon.ico" />
进入这个:
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
我将在下面留下原始答案,因为 setup.exe 问题可能与其他人有关.
I will leave the original answer below since the setup.exe issue might be relevant for others.
还有一件事:我被告知对话框设置了
是可用 WiX 模板中更好的一个.不过,除了那个建议之外,我没有确凿的事实.我没有使用 <UIRef Id="WixUI_InstallDir";/>
- 只要它可以为您节省一些时间.And one more thing: I was told that the dialog set
<UIRef Id="WixUI_Mondo" />
is the better one in the available WiX templates. I have no hard facts apart from that recommendation though. I haven't used<UIRef Id="WixUI_InstallDir" />
- just if it can save you some time.旧答案:
这可能只是一个大写/小写问题.如在
icon.ico
而不是Icon.ico
.This might just be a uppercase / lowercase issue. As in
icon.ico
instead ofIcon.ico
.正确:
<Icon Id="Icon.ico" SourceFile="MySourceFiles\Icon.ico"/> <Property Id="ARPPRODUCTICON" Value="Icon.ico" />
错误:
<Icon Id="icon.ico" SourceFile="MySourceFiles\icon.ico"/> <Property Id="ARPPRODUCTICON" Value="Icon.ico" />
在我的测试过程中,虽然我收到了警告,但无论哪种方式,该图标都可以在添加/删除程序"中工作.您是否正在制作 setup.exe 包?
During my testing I get the warning though, but the icon does work in Add/Remove Programs either way. Are you making a setup.exe bundle?
当您制作 setup.exe 引导程序包时,您必须设置 捆绑元素.
When you make a setup.exe bootstrapper bundle, you have to set the
IconSourceFile
attribute of the Bundle Element.保管链接:如何为 Wix 自定义引导程序自定义图标.
这篇关于添加/删除程序中的 Wix 图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!