Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INSTALLDIR folder is not removed on uninstall #1114

Closed
gvsoft3750 opened this issue Feb 2, 2022 · 5 comments
Closed

INSTALLDIR folder is not removed on uninstall #1114

gvsoft3750 opened this issue Feb 2, 2022 · 5 comments

Comments

@gvsoft3750
Copy link

gvsoft3750 commented Feb 2, 2022

I seem to have discovered a case where the installation folder will not get removed upon uninstalling. This case seems to be the result of creating a sub-directory(ies) under the main directory, like this:

new ManagedProject("MyProductSetup",
                   new Dir(@"%ProgramFiles%\MyCompany\MyProduct\MyApp",
                           new Dir(@"Logs") // after adding this, the install folder will NOT be removed at uninstall
                   )
);

Interestingly, the "Logs" folder is removed, but none of its parent folders are removed.

How do I fix this?

Thanks,

Dennis

oleg-shilo added a commit that referenced this issue Feb 3, 2022
@oleg-shilo
Copy link
Owner

I just tested your scenario and even put a test case for it (c79c9cd). The whole directory is getting removed on uninstall.

I have attached the msi and wxs (the whole build dir is also there)
test.zip

@gvsoft3750
Copy link
Author

Thank you for looking into it, Oleg. There must be something else about my setup that is causing the problem. I know nothing about MSI or WiX. Any suggestions for how to identify what causes folders to not get removed?

Dennis

@oleg-shilo
Copy link
Owner

The problem itself is an MSI chellende. WixSharp (and WiX for that matter) plays a little role in it.

WixSharp only ensures that the corresponding RemoveFolder element is inserted for the directory you are asking:
image

But it is MSI runtame , which is responsible for actual deletion of the folder. And it does it at least in the test I have done and shared with you.

Did you try to run msi I shared with you?

. . .

Anyway, the usual reasons for the folder not being removed is that it contains files that were not put there by the msi that created the folder. The name of your folder (logs) suggests that indeed you are planing your app to create log files there. Big no-no :)

Another reason is another install that creates the folder with the same name. Not sure your case

@gvsoft3750
Copy link
Author

gvsoft3750 commented Feb 4, 2022

Well, in my case, it isn't because there are existing files (because I am just testing the install/uninstall process). I did see the expected behavior when my project was smaller (folders would delete, except when there were existing files). But somewhere along the line, that behavior changed. There is no other folder with the same name either.

Yes, I realize we should not be creating data in the program files folders, but it is legacy code that we have not modified yet. I'll discuss this with our team, as I totally agree that we should not be doing that.

Here is what my actual wxs looks like:

image

I don't think the PermissionEx entry is related, because when I remove the DirPermission property from my code, the problem still occurs. And, as I said before, the Logs folder IS removed. The PARENT folders (MyCompany\MyProduct\MyApp) folders are NOT.

I will keep investigating and report anything new I find.

Dennis

@oleg-shilo
Copy link
Owner

Good luck Denis

oleg-shilo added a commit that referenced this issue Mar 1, 2022
- Added WPF stock dialogs for Custom UI (WixSharp.Ui.WPF assembly)
- Added test case for #1114
- Issue #1087: Intermittent error
- "WixSharp Project Templates" extension is ported to VS2022
- Issue #1096: Setting RegistrySearch Id causes infinite loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants