59

When I am trying to create the installer i am getting the following error:

The directory ProgramMenuDir is in the user profile but is not listed in the RemoveFile table.

How do I resolve this issue? Below is the directory structure I am using:

<Directory Id="ProgramMenuFolder" Name="Programs">
  <Directory Id="ProgramMenuDir" Name="E">
    <Directory Id="Monarch" Name="Monarch">
      <Component Id="Monarch" Guid="*">                       
        <RemoveFolder Id='Monarch' On='uninstall' />
        <RemoveFolder Id='ProgramMenuDir' On='uninstall' />
        <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' 
                                   Type='string' Value='' KeyPath='yes' />
      </Component>
    </Directory>
  </Directory>
</Directory>
sharptooth
  • 167,383
  • 100
  • 513
  • 979
subs
  • 2,189
  • 12
  • 35
  • 59
  • How about I want to have Monarch subfolder deleted on uninstall, but I don't want its parent folder ProgramMenuDir to be deleted? Perhaps, that parent folder is the company name folder and has many other products of the same company created subfolders under it. – Tiger Galo May 05 '20 at 15:19

4 Answers4

81

As far as I can see, the problem is in the usage of <RemoveFolder/> element. If the 'Directory' attribute is omitted, it takes the directory of the parent component. In your case, it is a directory with Id="EFIMonarch". This explains why you get the warning for the outer directory (ProgramMenuDir), but don't get it for EFIMonarch directory.

Try replacing:

<RemoveFolder Id='ProgramMenuDir' On='uninstall' />

with

<RemoveFolder Id='RemoveProgramMenuDir' Directory='ProgramMenuDir' On='uninstall' />

Also, it is a good idea to be explicit for every RemoveFolder element.

Hope this helps.

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
  • 24
    In my case I was seeing this error because I had forgotten to add the component as a feature. – satnhak Jan 31 '13 at 12:44
  • @TheMouthofaCow same for me. – Ronnie Overby Jun 13 '13 at 18:02
  • 2
    Would be nice to have that property in the tutorial, I think most could figure it out intuitively if it was. This is the only article I could find that bothered to explain why instead of just providing a non-working example. – Melikoth Aug 21 '14 at 18:49
  • 3
    [Wix's tutorial](http://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/create_start_menu_shortcut.html) does an amazing job at obfuscating the function of these attributes. Re-using the same `Id` for completely different elements, making it seem as if they're references rather than unrelated identifiers. – Drazen Bjelovuk May 14 '16 at 15:29
  • Many thanks for this. After much head scratching and confusion over two ICE64 errors, your answer came to the rescue! – Xyon Aug 21 '17 at 13:26
  • 2
    I had this same error and Google brought me here. However in my case, I was missing a `` under the Feature tag. Wix is obscure af. – Michael Brown Mar 09 '20 at 03:51
3

If other answers are still not working for you, try to check Suppress ICE validation option, Visual studio will ignore these validations, just follow this route:

YourProject -> Properties -> Tool Settings

ICE validation

xKobalt
  • 1,498
  • 2
  • 13
  • 19
1

Just writing this up for some others who may still experience this problem even after following the answer for this question.

I had the same problem, and even after explicitly specifying the Directory in the RemoveFolder did not help me, I tried to put this DirectoryRef containing the shortcut install/uninstall somponents right after the TARGETDIR within the same fragment and it helped fix my issue.

Suhaib Ahmad
  • 487
  • 6
  • 25
-6

If following answer still still not working. Try to reboot your visual studio.

MC Qu
  • 77
  • 1
  • 1