[wix-users] RemoveFiles cannot remove a file created just before service is stopped

Edwin Castro egcastr at gmail.com
Thu Dec 15 16:55:10 PST 2022

We have a service that is stopped on both install/uninstall via
ServiceControl that writes data files to disk as it is stopping. We use
RemoveFolderEx to remove files/folders in our service's data folder that
are created at runtime. Occasionally, we see that one of these data files
does not yet exist on disk when RemoveFiles/RemoveFolders run but is
written by the service just before it stops. Msiexec attempts to remove the
parent folder because it already existed when RemoveFiles/RemoveFolders
ran. But msiexec does not attempt to remove the data file as it did not
exist when RemoveFiles/RemoveFolders ran.

Before I go off and write a custom action to handle this specific case, is
there anything else I can try to ensure this file is deleted even when it
is created after RemoveFiles/RemoveFolders but before the service is
actually stopped?

Edwin G. Castro

More information about the wix-users mailing list