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

Scott Smith wix-devs at scott-smith.us
Fri Apr 2 15:53:16 PDT 2021


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.




More information about the wix-devs mailing list