Wix - ICE 64 error: Link external componentgroups

青春壹個敷衍的年華 提交于 2019-12-11 06:15:52

问题


i use heat to harvest my files i need as components in my Setup and write them to a separate wxs file, which works perfect.

Example of generated file:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="AppData_dir_ref">
            <Directory Id="GUID" Name="C" />
            <Directory Id="GUID" Name="OLD" />
        </DirectoryRef>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="AppData_ComponentGroupId">
            <Component Id="GUID" Directory="GUID" Guid="{GUID}">
                <File Id="GUID" KeyPath="yes" Source="$(var.test)\C" />
            </Component> ...

... and so on....

Now i use them in my SetupMain:

  <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

        <Product Id="*" 
                Name="SETUP TEST 1.0" 
                Language="1031"
                Version="1.0.0.0" 
                Manufacturer="bla" 
                UpgradeCode="ID">

            <Package Id="*"
                     Keywords="Installer"
                     InstallerVersion="300" 
                     Compressed="yes"
                     Languages='1031'
                     SummaryCodepage='1252'
                     Manufacturer="bla"
                     Description="Setup"
                     Comments="bla" 
                     InstallScope="perMachine"/>

            <Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />

            <Directory Id="TARGETDIR" Name="SourceDir" >
                <Directory Id="LocalAppDataFolder" >
                    <Directory Id="AppData_dir_ref" Name="Test" />

                </Directory>
            </Directory>

            <Feature Id="F.Core" Title="bla" Level="1">
                <Feature Id="F.Data">
                    <ComponentGroupRef Id="AppData_ComponentGroupId" />
                </Feature>
            </Feature>

        </Product>
    </Wix>

Unfortunately i got ICE64 errors for all my components and directories:

ICE64 Error: The directory XX is in the user profile but is not listed in the RemoveFile table ICE64 Error: The component xx enter code hereinstalls to user profile it must register a registry key under HKCU as its key path, not a file ...

How can i fix it? I searched a while in the internet but couldn´t find a hint. It seems to be something really simple and basically i forgot to define in my main. My aim is to build a simple installer which copies the directory structure defined in the file build with heat command while installing and deletes it when uninstalling.

UPDATE 1: Small Update how i fixed the errors with the help of the answers below using RemoveFolder and RegistryValue Tags:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="AppData_dir_ref">
            <Directory Id="dir1" Name="C" />
            <Directory Id="dir2" Name="OLD" />
        </DirectoryRef>
    </Fragment>
    <Fragment>
        <ComponentGroup Id="Cg.R">
            <Component Id="test" Directory="Data" Guid="...">
                <RemoveFolder Id="Data" On="uninstall" Directory="AppData_dir_ref"/>
                <RemoveFolder Id="Rf.1" On="uninstall" Directory="C"/>
                <RemoveFolder Id="Rf.2" On="uninstall" Directory="OLD"/>
                <RegistryValue Root="HKCU" Key="Software\...\..." Name="installed" Type="integer" Value="1" KeyPath="yes"/>
            </Component>
        </ComponentGroup>    
    </Fragment>

    <Fragment>
        <ComponentGroup Id="Cg.D">
            <Component Id="cmp5" Directory="dirC23" Guid="...">
                <File Id="fil2" Source="Bla\...\...\...xml" />
                <RemoveFolder Id="Rf.b" On="uninstall" Directory="dirC23"/>
                <RegistryValue Root="HKCU" Key="Software\...\..." Name="installed" Type="integer" Value="1" KeyPath="yes"/>
            </Component>

... I don´t know if its the best way to do so, but its working for now. Any improvement suggestions or best practices when using it with heat.exe automation are appreciated.

Last point is that i still have warnings:

ICE91: File x will be installed to the per user directory y that doesn´t vary based on ALLUSERS value. This file won´t be copied to a per user profile even if a per-machine installation is desired.

I read that this warning is harmless. But anyway, it would be nice to understand the reason to maybe solve the warning sometime in the future.


回答1:


Both these validation errors relate to installing to the user profile, or installing per-user data as the expression goes. In short installing files that are duplicated on disk for each user: C:\Users\User1\MyFile.txt , C:\Users\User2\MyFile.txt, etc...

You need to add a remove folder entry for all folders that install to a per-user folder path in order to pass MSI validation. In your case this is AppData_dir_ref.

Likewise you also need to set a HKCU registry key path for components that install to the user profile. So instead of setting C:\Users\User1\MyPath you set the key path to something like HKCU\Software\YourCompany\YourProduct for the component that installs to the user profile.

I don't have Wix set up to test compile, but here is a mock-up of roughly what you need:

   <Component Id="RemoveFolder">
      <RemoveFolder Id="MyUserProfileFolder" On="uninstall" Directory="AppData_dir_ref"/>
      Your content here...
    </Component>

     ...

   <Component Id="UserProfile">
      <RegistryValue Root="HKCU" Key="SOFTWARE\YOURCOMPANY\YOURPRODUCT" Name="Complete" 
                     Value="TestValue" Type="string" KeyPath="yes"/>
      Your content here...
    </Component>


来源:https://stackoverflow.com/questions/39413247/wix-ice-64-error-link-external-componentgroups

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!