[wix-devs] Ensuring that App is closed before trying to remove log file?

Rob Mensching rob at firegiant.com
Fri Apr 2 19:12:39 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.

-----Original Message-----
From: wix-devs <wix-devs-bounces at lists.wixtoolset.org> On Behalf Of Scott Smith via wix-devs
Sent: Friday, April 2, 2021 3:53 PM
To: wix-devs at lists.wixtoolset.org
Cc: Scott Smith <wix-devs at scott-smith.us>
Subject: [wix-devs] Ensuring that App is closed before trying to remove log file?

For several reasons, I'd like to ensure that our app isn't running (or we automatically close it, or the user is prompted to close it) during a major upgrade or uninstall.

When uninstalling our app, the user gets an Access Denied message on a log file that our app hasn't opened with SHARED_DELETE flags (or whatever). A prompt appears letting the user that the file is in use, but since it's a log file (that they normally aren't aware of), our users may not realize that they need to close one of our apps.

There are two issues here -- (1) Direct Windows Installer to close our app, and (2) ensure that the close is done prior to attempting the deletion of the files.

This question is primarily about the second issue. I originally thought that I could ensure basic ordering using nesting of components and component groups, but I realize now that control is very limited (or I'm missing something).

When I search for possible solutions, everyone's go-to seems to be a custom action, but the blogs and guides I've read strongly recommend against them.

I'm assuming that the answer would involve <util:CloseApplication> and <DeleteFile>, but I don't see how they can be specified in such a way that WiX sequences them appropriately (or that will force their sequence).

Is there a generally-agreed-upon best practice or range of solutions for this?

Thanks.


____________________________________________________________________
WiX Toolset Developer Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-devs mailing list