Search code examples
wix4wix5

wix toolset (v4, v5) - error WIX0204: ICE64 The directory is in the user profile but is not listed in the RemoveFile table


I have an error when I create, then validate my msi.

error WIX0204: ICE64: The directory dB83QhXjqRcvjpneY0SXNy5LuEUs is in the user
profile but is not listed in the RemoveFile table.

It seems to be related to the fact that the folder is in the start menu directory.

Despite the error the directory is properly removed, when I uninstall the software.

I created a simple version of my installer with a bash script and a wxs file, and I played with the attributes of RemoveFolder tag but the problem is still there.

create-installer

#!/bin/bash

set -x

printf "Is that really that simple?\n" > simple.txt

WIX_CURRENT_VERSION=$( wix --version | grep -o "[0-9]*\.[0-9]*\.[0-9]")

# Add user interface extension for wix TODO add a test to check id already installed before calling it
wix extension add -g WixToolset.UI.wixext/${WIX_CURRENT_VERSION}

# Build package
wix build \
    -arch x64 \
    -d ApplicationDisplayName="Simple" \
    -d ApplicationVersion="1.0.0" \
    -d ApplicationCompany="Company" \
    simple.wxs \
    -pdb simple.wixpdb \
    -ext WixToolset.UI.wixext/${WIX_CURRENT_VERSION} \
    -o simple.msi

# Validate package
wix msi validate \
    -pdb simple.wixpdb \
    simple.msi

simple.wxs

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">

    <Package Name="$(ApplicationDisplayName)"
             Version="$(ApplicationVersion)"
             Manufacturer="$(ApplicationCompany)"
             UpgradeCode="8fe1ff09-9f20-4bf4-bad0-3928af79071c"
             Language="1033"
             Compressed="yes"
             Scope="perUserOrMachine">
        <!-- 1033 is en-US (LCID code) -->

        <MediaTemplate EmbedCab="yes"/>

        <StandardDirectory Id="ProgramFiles64Folder">
            <Directory Id="APPLICATIONFOLDER" Name="$(ApplicationCompany)\$(ApplicationDisplayName)">
            </Directory>
        </StandardDirectory>

        <StandardDirectory Id="ProgramMenuFolder">
            <Directory Id="startmenudirectory" Name="$(ApplicationCompany)\$(ApplicationDisplayName)">
            </Directory>
        </StandardDirectory>

        <ComponentGroup Id="applicationrootdirectoryapplicationcomponent">
            <Component Id="simple.txt" Directory="APPLICATIONFOLDER" Guid="4f4613c5-7c1f-49de-b278-99114986b825">
                <File Id="simple.txt" Source="simple.txt" KeyPath="yes"/>
            </Component>
        </ComponentGroup>

        <ComponentGroup Id="startmenucomponent">
            <Component Id="startmenushortcut" Directory="startmenudirectory" Guid="d85f20ab-1165-47b8-a196-33dcdb428f36">
                <Shortcut Id="startmenushortcut"
                          Name="$(ApplicationDisplayName)"
                          Description="Add a shortcut to the start menu"
                          Target="[APPLICATIONFOLDER]simple.txt"/>

                <RemoveFolder Directory="startmenudirectory" On="uninstall"/>

                <RegistryValue Root="HKCU"
                               Key="Software\$(ApplicationCompany)\$(ApplicationDisplayName)\StartMenuShorcut"
                               Name="installed"
                               Type="integer"
                               Value="1"
                               KeyPath="yes"/>
            </Component>
        </ComponentGroup>

        <ComponentGroup Id="desktopcomponent">
            <Component Id="desktopshortcut" Directory="DesktopFolder" Guid="b57a196f-aa70-40ba-ab35-83b88c53866f">
                <Shortcut Id="desktopshortcut"
                          Name="$(ApplicationDisplayName)"
                          Description="Add a desktop shortcut"
                          Target="[APPLICATIONFOLDER]simple.txt"/>
                <RegistryValue Root="HKCU"
                               Key="Software\$(ApplicationCompany)\$(ApplicationDisplayName)\DesktopShorcut"
                               Name="installed"
                               Type="integer"
                               Value="1"
                               KeyPath="yes"/>
            </Component>
        </ComponentGroup>

        <Feature Id="MainApplication" Display="expand" AllowAbsent="no" Title="$(ApplicationDisplayName)" Level="1">
            <ComponentGroupRef Id="applicationrootdirectoryapplicationcomponent"/>
            <Feature Id="StartMenuShorcut" Title="Start menu shortcut" Level="1">
                <ComponentRef Id="startmenushortcut"/>
            </Feature>
            <Feature Id="DesktopShorcut" Title="Desktop shortcut" Level="1">
                <ComponentGroupRef Id="desktopcomponent"/>
            </Feature>
        </Feature>

        <Property Id="ApplicationFolderName" Value="$(ApplicationCompany)\$(ApplicationDisplayName)"/>
        <Property Id="WixAppFolder" Value="WixPerUserFolder"/>

        <UIRef Id="WixUI_ErrorProgressText"/>

        <ui:WixUI Id="WixUI_Advanced"/>

    </Package>
</Wix>

Solution

  • It was because my startmenudirectory contained actually two directories (Name="$(ApplicationCompany)\$(ApplicationDisplayName)") and only one was listed with RemoveFolder

    Now I use two different directories

        <StandardDirectory Id="ProgramMenuFolder">
            <Directory Id="startmenucompanydirectory" Name="$(ApplicationCompany)">
                <Directory Id="startmenuapplicationdirectory" Name="$(ApplicationDisplayName)">
                </Directory>
            </Directory>
        </StandardDirectory>
    

    And I list both as removable in the ComponentGroup

        <ComponentGroup Id="startmenucomponent">
            <Component Id="startmenushortcut" Directory="startmenudirectory" Guid="d85f20ab-1165-47b8-a196-33dcdb428f36">
                <Shortcut Id="startmenushortcut"
                          Name="$(ApplicationDisplayName)"
                          Description="Add a shortcut to the start menu"
                          Target="[APPLICATIONFOLDER]simple.txt"/>
    
                <RemoveFolder Directory="startmenuapplicationdirectory" On="uninstall"/>
                <RemoveFolder Directory="startmenucompanydirectory" On="uninstall"/>
    
                <RegistryValue Root="HKCU"
                               Key="Software\$(ApplicationCompany)\$(ApplicationDisplayName)\StartMenuShorcut"
                               Name="installed"
                               Type="integer"
                               Value="1"
                               KeyPath="yes"/>
            </Component>
        </ComponentGroup>
    

    And I have no error