Dzi Lean
Dzi Lean

Reputation: 89

Why are logs left after removal of an application has occurred?

I am struggling against the issue with wix toolset: why after I uninstall an application some folders including the "logs" are not deleted? is it a bug or not?

<Directory Id="logs" Name="logs">
<Component Id="logs" Guid="0A4D0A3F-2E0D-1B1A-1C6D-1A0F8FAAABC6" Win64="$(var.is64)">
      <CreateFolder Directory="logs">
       <Permission GenericAll="yes" User="Everyone" />
       </CreateFolder>
       <RemoveFolder Id="logs"  On="uninstall"></RemoveFolder>
       </Component>
       </Directory>

Upvotes: 1

Views: 169

Answers (1)

Ryan Quasney
Ryan Quasney

Reputation: 91

Sometimes if the application you install generates files or folders after the installation, that can prevent WiX from removing the parent folder during uninstall.

If there are log files created after install, you can purge them by adding this to your existing component:

<RemoveFile Id="RemoveLogFiles" Name="*.*" On="uninstall" />

If your application also creates subdirectories and RemoveFile doesn't get rid of them, I would look into using RemoveFolderEx(http://wixtoolset.org/documentation/manual/v3/xsd/util/removefolderex.html). This would require you to to create a Property and write the directory path to a place in the registry so you can set the Property before RemoveFolderEx runs. You can't just use the Directory Id because RemoveFileEx runs before the MSI creates the Directory properties. Read the link I provided if my explanation didn't make sense to you.

Hope this helps!

Upvotes: 1

Related Questions