1

My installer created with MS WiX installs a component (some files) into an existing folder in the user's App Data directory. This existing folder is empty. Thus, when uninstalling, the installer will remove this folder - which it shouldn't do. So how to prevent this?

The code is:

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="LocalAppDataFolder" Name="AppData">
    <Directory Id="OtherCompanysFolder" Name="OtherCompany">
      <Directory Id="OtherProductsFolder" Name="Product">
        <Directory Id="AddOnsFolder" Name="AddOns">
          <Directory Id="MyAddOnFolder" Name="MyAddOn">
          </Directory>
        </Directory>
      </Directory>
    </Directory>
  </Directory>
</Directory>
</Fragment>

    <Fragment Id="AddOnFiles">
    <ComponentGroup Id="ProductComponents" Directory="MyAddOn">
      <Component Id="ProductComponent" Guid="{xxx}">
        <RegistryKey Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.Product)">
          <RegistryValue Type="string" Value="" KeyPath="yes" />
        </RegistryKey>
        <RemoveFolder Id="RemoveMyAddOnFolder" On="uninstall" Directory="MyAddOnFolder" />
        <RemoveFolder Id="RemoveAddOnsFolder" On="uninstall" Directory="AddOnsFolder" />
        <RemoveFolder Id="RemoveOtherProductsFolder" On="uninstall" Directory="OtherProductsFolder" />
        <RemoveFolder Id="RemoveOtherCompanysFolder" On="uninstall" Directory="OtherCompany" />
        <File Id="Executable" Source="path\to\My.exe" />
      </Component>
    </ComponentGroup>
    </Fragment>

The problem is, if I remove the nodes

<RemoveFolder Id="RemoveAddOnsFolder" On="uninstall" Directory="AddOnsFolder" />
<RemoveFolder Id="RemoveOtherProductsFolder" On="uninstall" Directory="OtherProductsFolder" />
<RemoveFolder Id="RemoveOtherCompanysFolder" On="uninstall" Directory="OtherCompany" />

The Light and Ice will complain:

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

Keepting these nodes makes Light and Ice happy, but it will remove AddOnsFolder (which it shouldn't do).

Any ideas what I could do?

PS: In the comment section it was recommended to suppress the error message with a flag (-sice:ICE64). This is NO solution. While the installer now compiles, the AddOn folder is still removed (which must not happen)

10
  • "Light and Ice will complain" -- copy+paste of exact error message please.
    – zett42
    Jun 15, 2019 at 11:52
  • I modfied my post and added the error message Jun 15, 2019 at 14:19
  • 1
    Is this a per-user only setup? For per-machine setups I always recommend not installing to the user-profile folders, but to instead copy template files from a per-machine location to each user profile on application launch. Some links: 1, 2, 3. Jun 16, 2019 at 1:29
  • One "hack" is to install a marker / flag file as permanent so that the folder is not removed by MSI on uninstall. Maybe you could make that file hidden too, I didn't try. I suppose you could also suppress that validation error? Why is it critical to keep this folder? Custom ACL permissions? Jun 16, 2019 at 10:12
  • Suppress ICE error (Votive / Visual Studio). I think it is -sice:ICE64 via the command line. Jun 16, 2019 at 10:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.