1

I have an application that create a Log folder if it doesn't exist and log files (per date) each time the application run. I have created a setup for the application. When uninstalling the application, the Log folder is still there with all the log files. Is there a way to remove the folder from the file system when uninstalling the application?

I succeed to add a folder that is created during the installation. In case no log files are created inside this folder, the uninstall operation remove also the Log folder. But if there are files inside, the remove operation remove the entire installation but the folder with its contents are still in the file system. Is there a way to remove those files during the uninstall operation?

ehh
  • 3,114
  • 2
  • 29
  • 71

1 Answers1

1

If the application creates the log files then Windows Installer knows nothing about them and you must remove them if needed. You've tagged your question both Visual Studio and Windows Installer, so there are two answers, not knowing what tool you are using to create MSI files:

  1. If you're using Visual Studio Setup projects you need an uninstall custom that enumerates the files in the folder and removes them. This will make the Log folder empty at removal time so it should disappear.

  2. Other Windows Installer tools have support for the RemoveFiles action: https://msdn.microsoft.com/en-us/library/aa371201(v=vs.85).aspx

You should decide what you want to do on an upgrade. If you want to keep those files then a custom action should have the condition REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE.

PhilDW
  • 19,260
  • 1
  • 14
  • 23