Hello,

could someone help in the correct way of deleting extra files and
folders at uninstallation with util:RemoveFolderEx?

Our software is a collection of smaller pieces. All of those leave log
files or other stuff around that will need to be deleted at
uninstallation. This can be taken care of by manually defining the files
to be deleted with combination of RemoveFile and RemoveFolder elements.
This works, but is a bit cumbersome.

In 3.6 release came this excellent addition of util:RemoveFolderEx. With
that I can delete the entire installation folder, and things work nicely
(assuming I've stored the installation location in registry). There is
one problem, though.

If I use this mechanism, the parent folders are not deleted. This is
fine, if the user installs into the default location at Program Files
(after all, we do not want to remove the Program Files folder). But if
he decides to install to c:\foo\bar\baz, the folder structure of
c:\foo\bar will be left around.

Note that I get this behavior only, if the extra files are in
subfolders. If the extra files are in the root installation directory,
then the entire folder structure is deleted, as I would expect.

Is this normal behavior, or am I doing something incorrectly? I'm adding
a small example at the end, so you can check for any obvious problems.

Thanks,

-Marko

---------------------------

The code sample:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension";>
  <Product Id="*" Name="WixInstallationDirectory" Language="1033"
           Version="1.0.0.0" Manufacturer="Example"
           UpgradeCode="26d267f5-d8de-43d7-a90f-7ea8dde5dca3">
    <Package InstallerVersion="200" InstallScope="perMachine" />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="WixInstallationDirectory"
Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>
    <Property Id="INSTALLFOLDER">
      <RegistrySearch Key="Software\just\example" Root="HKLM" Type="raw"
                      Id="InstallationDirectoryRegistrySearch"
                      Name="InstallLocation" />
    </Property>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="Parent" Name="Parent">
          <Directory Id="INSTALLFOLDER" Name="Final">
          </Directory>
        </Directory>
      </Directory>
    </Directory>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents">
      <Component Id="ProductComponent"
                 Guid="{5DF59107-A440-49C9-AEE4-BD2FB22DF1D6}"
                 Directory="INSTALLFOLDER">
        <File Name="Product.wxs"/>
        <RegistryKey Root="HKLM" Key="Software\just\example">
          <RegistryValue Name="InstallLocation" Type="string"
                         Value="[INSTALLFOLDER]" Action="write"
                         KeyPath="yes" />
        </RegistryKey>
        <util:RemoveFolderEx Id='RemoveInstallationFolder'
On="uninstall"
                             Property="INSTALLFOLDER"/>
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to