xml - Wix - ICE60 和 ICE69 警告

标签 xml wix

我在使用 WiX 时遇到了一些问题。我当前的警告是 ICE60,它告诉我我的 .ttf 文件不是字体,并且它的版本不是配套文件引用。它应该在“语言”列中指定一种语言。

此警告的问题是我无法为文件设置语言版本。根据有关此警告的 MSDN 文档,我可以通过向字体文件添加版本来抑制它。不完全确定如何!

我的下一个警告是 ICE69,不匹配的组件引用。快捷方式表的条目“ApplicationStartMenuShortcut”属于组件“ApplicationShortcut”。但是,“目标”列中的格式化字符串引用属于组件“MyApp.exe”的文件“MyApp.exe”。组件具有相同的功能。

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<?include "config.wxi"?>
<Product Id="*" UpgradeCode="67bd6fc7-c75b-434b-a305-2808541f8185" Version="1.0.0.0" Language="1033" Name="MyApp" Manufacturer="MyApp">

    <Package InstallerVersion="300" Compressed="yes"/>
    <Media Id="1" Cabinet="MyApp.cab" EmbedCab="yes" />

    <PropertyRef Id="NETFRAMEWORK45" />

    <Condition Message="This application requires .NET Framework 4.5. Please install the .NET Framework then run this installer again.">
        <![CDATA[Installed OR NETFRAMEWORK45]]>
    </Condition>

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="APPLICATIONROOTDIRECTORY" Name="MyApp">
                <Directory Id="RESOURCESDIRECTORY" Name="Resources" />
            </Directory>
        </Directory>
        <Directory Id="ProgramMenuFolder">
            <Directory Id="ApplicationProgramsFolder" Name="MyApp"/>
        </Directory>
    </Directory>

    <Icon Id="_MyApp.ico" SourceFile="$(var.SourceDir)\Resources\MyApp.ico" />
    <Property Id="ARPPRODUCTICON" Value="_MyApp.ico" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

    <DirectoryRef Id="APPLICATIONROOTDIRECTORY">
        <Component Id="MyApp.exe" Guid="*">
            <File Id="MyApp.exe" Source="$(var.SourceDir)\MyApp.exe" KeyPath="yes" Checksum="yes"/>
        </Component>
        <Component Id="Xceed.Wpf.Toolkit.dll" Guid="*">
            <File Id="Xceed.Wpf.Toolkit.dll" Source="$(var.SourceDir)\Xceed.Wpf.Toolkit.dll" KeyPath="yes" Checksum="yes" />
        </Component>
    </DirectoryRef>
    <DirectoryRef Id="RESOURCESDIRECTORY">
        <Component Id="MyApp.ico" Guid="*">
            <File Id="MyApp.ico" Source="$(var.SourceDir)\Resources\MyApp.ico" KeyPath="yes" />
        </Component>
        <Component Id="FontAwesome.ttf" Guid="*">
            <File Id="FontAwesome.ttf" Source="$(var.SourceDir)\Resources\FontAwesome.ttf" KeyPath="yes" />
        </Component>
    </DirectoryRef>
    <DirectoryRef Id="ApplicationProgramsFolder">
        <Component Id="ApplicationShortcut" Guid="*">
            <Shortcut Id="ApplicationStartMenuShortcut"
                      Name="MyApp"
                      Description="Off-browser chat client for MyApp"
                      Target="[#MyApp.exe]"
                      WorkingDirectory="APPLICATIONROOTDIRECTORY" />
            <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
            <RegistryValue Root="HKCU" Key="Software\Microsoft\MyApp" Name="installed" Type="integer" Value="1" KeyPath="yes" />
        </Component>
    </DirectoryRef>

    <Feature Id="MainApplication" Title="Main Application" Level="1">
        <ComponentRef Id="MyApp.exe" />
        <ComponentRef Id="Xceed.Wpf.Toolkit.dll" />
        <ComponentRef Id="MyApp.ico" />
        <ComponentRef Id="FontAwesome.ttf" />
        <ComponentRef Id="ApplicationShortcut" />
    </Feature>
</Product>
</Wix>

尽管有这两个警告,该应用程序仍能正常安装和运行。虽然谁喜欢警告,嗯?

非常感谢对这些错误的任何帮助,我不想完全压制它们,以防万一存在潜在问题。

最佳答案

关于 ICE69 警告,我想我会就此提供更全面的讨论,因为我自己刚刚经历过这个......


来自MSDN documentation for ICE69 :

Problems with cross-component referencing arise from the way formatted strings are evaluated. If the component referenced with the [$componentkey] property is already installed and is not being changed during the current installation (for example, being reinstalled, moved to source, and so forth), the expression [$componentkey] evaluates to null, because the action state of the component in [$componentkey] is null. Similar problems can occur during upgrade and repair operations.

文档继续解释当引用跨越不同功能的组件时,消息是一个错误,因为定义功能可能没有安装,而引用功能是,导致字符串的空值。

当两个组件具有相同的功能时,大概是因为一个组件只与另一个一起安装,所以可以安全地使用该字符串。因此您会收到警告,表明您正在做一些可能不安全但可能会奏效的事情。

有很多方法可以解决这个问题,包括:

  • 大锤:只是禁用警告。打开 WiX 项目的属性,选择“工具设置”选项卡,然后在“禁止特定 ICE 验证:”字段中输入“ICE69”:

enter image description here

  • 实用:通过格式化字符串解释方式的一个怪癖,您可以使用语法 [!...] 而不是 [#. ..] 并欺骗编译器忽略该问题。来自 the MSI documentation :

If a substring of the form [!filekey] is found, it is replaced by the full short path of the file, with the value filekey used as a key into the File table. This syntax is valid only when used in the Value column of the Registry or the IniFile tables. When used in other columns this syntax is treated the same as [#filekey] .

换句话说,通过在实际未使用语法的情况下使用 [!...] 语法,编译器不会进行分析来处理警告[#...] 语法,但最终 MSI 仍将其视为该语法。您已经有效地从编译器中隐藏了该格式化字符串。

  • 理论理想:使用宣传的快捷方式,例如the blog article由您的其他答案引用。显然,这仅在快捷方式中的引用生成警告时有效。 :) 当然,使用宣传的快捷方式会带来其他复杂性。但这是一个选项,可以消除警告(因为在这种情况下您甚至没有使用 Target 属性,并且没有格式化字符串)。

关于xml - Wix - ICE60 和 ICE69 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21320334/

相关文章:

WiX - 通过检查修订防止降级

c# - 如何在用户桌面文件夹上创建快捷方式

css - Sublime Text 3 - CSS 属性的配色方案

javascript - 风格不适用

java - Maven-ear-plugin 自定义最终名称

wix 安装程序失败错误代码 2819

wix - 如何将整个目录或项目输出添加到 WiX 包

wix - 使用 WIX 的 InstallDir UI 扩展时在两个退出对话框之间进行有条件的选择

java - 如果两个编辑文本字段不为空,如何更改图像按钮的可绘制性

java - 从 persistence.xml 中的系统/文件获取用户和密码