I'm facing an issue in my .net installer application which will install three windows application together. In these three apps, one is a Windows Service. So, my installer project has three primary output from these three windows apps.
When installed, all these will be installed as expected and the Windows Service will be automatically "STARTED" after the installation.
However, if I uninstall the application (while the windows service is in "RUNNING" mode), the installer will show a "file in use" dialog and will eventually end up with the service not being uninstalled while the other things will be removed. However, if the Windows Service is stopped before uninstall, it will be completed nicely.
I assume that the above problem occurs because the installer app will try to remove the service.exe file (as it is also bundled into the installer).
I tried the below alternates:
I tried to overcome this by adding a custom installer in which I tried to stop the service. But, that also doesn't seem to be working. Reason for that is, the default "uninstall" action will be executed before the "uninstall" custom action. (FAILED)
Set the "Permanent" property of the "Primary output" of the Windows Service application to "true". I was under the assumption that the installer will simply skip the files related to the primary output. But (FAILED)
Anyone faced this kind of an issue ever and please share your thoughts on the same.
How can I stop the service before uninstall so that the un-installation will be completed successfully?