Directory NN is in the user profile, but is not listed in the RemoveFile table

Wix

Wix Problem Overview


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>

Wix Solutions


Solution 1 - Wix

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.

Solution 2 - Wix

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

Solution 3 - Wix

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.

Solution 4 - Wix

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsubsView Question on Stackoverflow
Solution 1 - WixYan SklyarenkoView Answer on Stackoverflow
Solution 2 - WixBouakkez AnouarView Answer on Stackoverflow
Solution 3 - WixSuhaib AhmadView Answer on Stackoverflow
Solution 4 - WixMC QuView Answer on Stackoverflow