0
votes

I have an installation created by wix which installs a couple of services. The services are installed by a custom action and not by the WIX for a couple of reason that can cannot be changed. Installation works fine unless I upgrade and then I receive the FilesInUse dialog. I'd like to handle the file in use myself in a custom action.

Is there any way I can run a custom action before the InstallValidate or disable the FilesInUse dialog? I'm using a generic WIX UI.

I've tried adding it to the InstallUIsequence, to the InstallExecutionSequence (before the InstallValidate) and disabling the restart manager control. Nothing worked.. (maybe I added it wrong in one of the sequences)

My custom action:

<CustomAction Id="StopServices"
              BinaryKey="CustomActionsDLL"
              DllEntry="StopServices"
              Execute="immediate"
              Return="check"/>

Any suggestions?

1

1 Answers

1
votes

Your requirement to install the service with a custom action instead of the built-in WiX/MSI capabilities doesn't mean you can't stop the service using WiX ServiceControl. If Windows Installer sees that the service will be stopped by ServiceControl then it won't invoke FilesInUse at InstallValidate time. If your service is different in some way this might not work - for example child processes that share common Dlls can cause FilesInUse dialogs. I assume you've looked at a verbose log and seen the processes and files that are in use.

The issue with your custom action is that that it's your code, and although it might be fine it's hard to know for a fact. Also, the problem with immediate custom actions is that they are not elevated and probably can't stop a service, so does your code check the ControlService result and so on?