Jeff Johnson
Jeff Johnson

Reputation: 99

Wix - How to only remove the app root directory during uninstall

Using Wix 3.5, Is there a way to limit the directories that are removed during an uninstall? Below is the structure I'm using:

<Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="CommonAppDataFolder" Name="CommonAppDataFolder">
        <Directory Id="CommonAppDataSubFolder1" Name="SubFolder1">
          <Directory Id="CommonAppDataSubFolder2" Name="SubFolder2">
            <Directory Id="CommonAppDataSubFolder3" Name="SubFolder3">
              <Directory Id="APPLICATIONROOTDIRECTORY" Name="My_App">
              </Directory>
            </Directory>
          </Directory>
        </Directory>
      </Directory>
</Directory>

I'd like to only remove the "APPLICATIONROOTDIRECTORY" in this case during an uninstall. My application is an addon to another vendor's parent application. Addon developers are supposed to install to a specific directory but not remove the entire folder structure during uninstall. I'd like to preserve sub folders 1 through 3.

Thank You,

Jeff

Upvotes: 0

Views: 905

Answers (1)

BryanJ
BryanJ

Reputation: 8563

WiX will not remove those directories if they are not empty.

Update: In your case, if the directories are empty and you want to keep them on uninstall, I would suggest removing the directory structure from your installer. Instead, use a custom action to set a property that contains the installation directory, and then install to that directory. I think that may work (but haven't tested it).

Upvotes: 1

Related Questions