Hi Joseph,

Let's first make sure we use correct terminology.  Wix is a tool to create MSI 
installers.  MSI installer installs, upgrades and uninstalls products and while 
doing that, it also creates/deletes folders among numerous other things.
One thing you can use to solve your problem is the fact that MSI will not 
delete non-empty folder.  So, your installer (or installed application on the 
first run) can create (not install) a file in the folder you want to keep 
during upgrade.  To be able to delete folder on uninstall (not upgrade) you can 
schedule custom action to remove the file.  Keep in mind that during uninstall 
(both upgrade and regular uninstall) property REMOVE will have value ALL 
(REMOVE=ALL) and property UPGRADINGPRODUCTCODE will exist only if product is 
removed during upgrade.  So, your extra file removal custom action should be 
scheduled as REMOVE=ALL AND NOT UPGRADINGPRODUCTCODE.

Alex



-----Original Message-----
From: Joseph B. Kowalski [mailto:jkowal...@greendotcorp.com] 
Sent: Friday, May 07, 2010 10:22 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] How to NOT Delete Application Directory on Uninstall?

Hi all,


My apologies if this is already answered somewhere, but I couldn't find an 
answer. My question is:

How can I setup a Wix installer to NOT delete the application directory on 
uninstall (even when the directory was initially created by the Wix install)?

Some background:

Let's say we have a Wix installer that installs an app in "C:\Dir1\Dir2". Well, 
the general behavior seems to be this:

- If "Dir2" doesn't already exist when the install happens, it will obviously 
be created at install time (along with "Dir1" as well, if necessary).
- If the "C:\Dir1\Dir2" path already exists at install time, then obviously it 
doesn't need to be created, and Wix will just install the necessary files 
underneath the path.
- On uninstall, if Wix had to create the "Dir2" directory at install time, it 
will also remove the "Dir2" directory (unless there are other stray files 
there, of course).
- On uninstall, if Wix DID NOT create the "Dir2" directory at install time (the 
path already existed), then it seems that Wix WILL NOT remove the "Dir2" 
directory.

In summary, on uninstall Wix will remove whatever part of the directory tree it 
created at install time, assuming nothing else has placed other content there 
since the install. This behavior is very logical and makes sense. The problem 
comes in when you have a situation like this:

- Let's say that after installing the above example app, we set some custom 
NTFS permissions on the "C:\Dir1\Dir2" folder.
- Let's also say that when we installed the app, the "C:\Dir1\Dir2" path didn't 
exist, so the install created it.

The problem now is that when we go to re-install this app (upgrading to a newer 
version of the app), when the uninstall portion of the install runs, it will 
remove the "Dir2" directory, and then re-add it when it gets to the "install" 
part, losing the custom NTFS permissions that were set.

What can I do to ensure that "Dir2" NEVER gets deleted when installing an newer 
version of the app (whether or not Wix initially created the directory at 
install time) so that the NTFS permissions of the directory are preserved 
through upgrades?

If this is impossible, I guess a secondary question would be: How can I 
enumerate the NTFS permissions of the existing folder before the uninstall 
happens, and then re-apply those same permissions after the directory is 
re-created? (although I'd much opt for the first solution)


Any help is greatly appreciated.


Thank you.


Joe

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

_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


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

_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to