Replies: 1 comment 2 replies
-
If the component Id (a guid) is unchanged for the component that contains the CreateFolder, it won't be removed during upgrades, but will be removed when running uninstall outside of a major upgrade. No condition necessary. Search for |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Our app keeps some system-wide configuration files under
C:\ProgramData\<OurAppName>
, so the install creates that directory and a few sub-directories:The app's 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, of course, because they contain files that weren't installed.
When a user performs a major upgrade, though, 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/*
(regardless of whether it was installed or not)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 above condition to these operations, I was going to create a separate component with just the RemoveFolder and RemoveFile elements, and condition the component on the expression above. Alas, several posts pointed out that since this new "component" will never be installed, the removals won't be executed during an uninstall either.
Is there some way to add entries to the
RemoveFile
table directly, based upon some condition?What is the current consensus on how to do this?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions