Add/Remove 个程序中的 Wix 图标

Wix icon in Add/Remove programs

我正在使用 Wix 创建我的安装程序。 根据官方documentation,如果我想在Add/Remove程序中更改图标,我需要添加:

<Icon Id="icon.ico" SourceFile="MySourceFiles\icon.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />

但它不起作用,图标没有改变,我也收到以下警告:

C:\Users\rsheink\home\repos\tenliraLira\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.

请问我错过了什么?

谢谢。雷法尔.

编辑: 根据@harper 的出色建议,这里是 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:如果以下任何一项对您有用,请发表评论 - 如果您还做了其他事情(也)让事情正常进行。

Quick List First:

  • Is ARPPRODUCTICON spelled correctly?
  • Does the File.ico file have a hidden file extension? Example: icon.ico.bmp - 1.
    • Show file extensions in Windows Explorer
    • Open a cmd.exe in the folder and do a dir to check?
  • Icon file problems:
    • Is that a proper *.ico file? Try to save a normal *.bmp and rename the extension to *.ico. That should work for a rudimentary test icon.
    • Find a proper template *.ico file for testing (there should be plenty in your Visual Studio installation folder).

更新:

请尝试更改此设置:

<Property Id="ARPPRODUCTION" Value="icon.ico" />

进入这个:

<Property Id="ARPPRODUCTICON" Value="icon.ico" />

我将在下面保留原始答案,因为 setup.exe 问题可能与其他人相关。

还有 一件事:有人告诉我对话框集 <UIRef Id="WixUI_Mondo" /> 是可用 WiX 模板中更好的一个。不过,除了该建议外,我没有确凿的事实。我还没有用过 <UIRef Id="WixUI_InstallDir" /> - 如果它能为你节省一些时间就好了。


旧答案:

这可能只是一个大小写问题。如 icon.ico 而不是 Icon.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" />

在我的测试过程中,虽然我收到了警告,但该图标在 Add/Remove 程序中确实有效。 您要制作 setup.exe 捆绑包吗?

当您制作 setup.exe 引导程序包时 ,您必须设置 Bundle Element.[=27= 的 IconSourceFile 属性]

A link 保管:How to customize icon for Wix custom bootstrapper.