[wix-devs] Clean up directories (possibly with extra non-installed files) on uninstall (but not major upgrade)

Sean Hall r.sean.hall at gmail.com
Fri Apr 2 16:03:08 PDT 2021


Wrong list :) If you have questions about using the toolset, use wix-users
or the experimental GitHub discussions area at
https://github.com/wixtoolset/issues/discussions. This list is for
questions about developing the toolset itself.

On Fri, Apr 2, 2021 at 5:52 PM Scott Smith via wix-devs <
wix-devs at lists.wixtoolset.org> wrote:

> - Our app keeps some system-wide configuration files under
> C:\ProgramData\OurAppName, so the install creates that directory and a
> few sub-directories:
>
>    C:\ProgramData
>       +- OurAppFolder
>          +- Foo1
>          |  +- Foo2
>          +- Bar1
>          |  +- Bar2
>          +- Baz1
>             +- Baz2
>
> - The configuration files, plus /foo/ and /bar/ and /baz/ files, etc are
> created in the sub-directories at runtime. An uninstall never removes
> any of these directories, because they contain files that weren't
> installed.
>
> - When a user performs a major upgrade, we'd like to /*not*/ remove the
> configuration information or other files
>
> - But when a user is doing a stand-alone uninstall (vs. nested as part
> of an upgrade), we would like to remove OurAppName and everything
> underneath
>
>
> I've found a number of posts about this on stackoverflow, etc, but no
> one seems to have a good solution that doesn't involve a custom action
> (which I'm led to believe are evil).
>
> I've been able to determine that the condition I need is: (NOT
> UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
>
> I initially bundled a bunch of <RemoveFolder ...> and <RemoveFile ...
> Name="*.*" ...> elements in the component containing the <CreateFolder
> ...> elements and the registry setting as the keypath. Of course, that
> just unconditionally removes everything on uninstall; even during a
> major upgrade.
>
> To apply the condition to these operations, I was going to create a
> separate component and condition it on the expression above, but several
> posts pointed out that since this new "component" will never be
> installed, it won't be executed later.
>
> What is the current consensus on how to do this?
>
>
> Thanks.
>
> ____________________________________________________________________
> WiX Toolset Developer Mailing List provided by FireGiant
> http://www.firegiant.com/
>



More information about the wix-devs mailing list