Sequencing the ServiceControl after InstallValidate does not matter. If a file usage situation is detected for a service in InstallValidate, but the service is in the ServiceControl table, which must be stopped when it is deleted, then Windows fairly reasonably postpones any file situation to see what is actually happening. If you select it from ServiceControl, you will lose this potentially useful function. Please note that you can use ServiceControl independently of ServiceInstall - they are not related to each other, so you do not need to run exe to stop the service if it can work well with ServiceControl.
A common cause of this situation is simple unacceptable maintenance. Wait = yes will not wait forever, only 30 seconds according to the documentation. Therefore, the service must respond to a control message telling it to stop. Even when the service is βstoppedβ, which does not mean that the process has left, only that it no longer works as a service. If some time is required for the final completion of the process, then Windows has no alternative but to show the files in use. These things are difficult to debug, because there are usually synchronization issues, but if it were me, I would carefully study the service shutdown code.
Note that you may need to stop = both in the update script. If InstallValidate (in your inbound update) does not see the installation stopping in ServiceControl, and there are files that are being used, you will get this file problem. InstallValidate does not look forward when RemoveExistingProducts may appear, and then switch to another MSI to stop the ServiceControl, which may prevent the use of files.
source share