Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wix - ICE60 and ICE69 warnings

Tags:

xml

wix

I'm having a few issues with WiX. My current warning is ICE60 which is telling me my .ttf file is not a font, and its version is not a companion file reference. It should have a language specified in the Language column.

Problem with this warning is that I'm unable to set a Version of Language for the file. According to MSDN docs about this warning, I can suppress it by adding a Version to the font file. Not entirely sure how!

My next warning is ICE69, Mismatched component reference. Entry 'ApplicationStartMenuShortcut' of the Shortcut table belongs to component 'ApplicationShortcut'. However, the formatted string in column 'Target' references file 'MyApp.exe' which belongs to component 'MyApp.exe'. Components are in the same feature.

<?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>

Despite both warnings, the application does install and work fine. Although who likes warnings, eh?

Any help with these errors are most appreciated, I don't want to suppress them altogether just incase there is an underlying issue.

like image 862
JLT93 Avatar asked Jan 23 '14 22:01

JLT93


1 Answers

With regards to the ICE69 warning, I thought I'd offer a more comprehensive discussion on that, having just been through this myself…


From the 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.

The documentation goes on to explain that when the reference is across components in different features, the message is an error, as the defining feature may not be installed while the referencing feature is, resulting in a null value for the string.

When the two components are in the same feature, presumably since one is only ever installed with the other, the string can be safely used. So you get a warning, indicating you're doing something potentially unsafe but which likely would work.

There are a number of ways to address this, including:

  • Sledge-hammer: just disable the warning. Open the properties for your WiX project, select the "Tool Settings" tab, and enter "ICE69" in the "Suppress specific ICE validation:" field:

enter image description here

  • Practical: through a quirk in the way that formatting strings are interpreted, you can use the syntax [!...] instead of [#...] and fool the compiler into ignoring the issue. From 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] .

In other words, by using the [!...] syntax in a scenario in which that syntax is not actually used, the compiler doesn't do the analysis to handle the warning for the [#...] syntax, but ultimately MSI still treats it as that syntax. You've effectively hidden that formatting string from the compiler.

  • Theoretical ideal: use advertised shortcuts, per e.g. the blog article referenced by your other answer. Obviously, this only works when the warning is generated by a reference in a shortcut. :) And of course, using advertised shortcuts introduces other complexities. But it is an option and will get rid of the warning (since you're not even using the Target attribute in that case, and have no formatted string).
like image 181
Peter Duniho Avatar answered Oct 13 '22 05:10

Peter Duniho