views:

128

answers:

1

Hi all,

I have a service MyService.exe that is babysitting my application MyApp.exe, meaning it starts the application when this one crashes or whatever. Basically when the service is stopped the application is stopped (by the service) and when the service is started the application is started by the service.

In order to stop my service and by that my application when uninstalling I'm doing:

<ServiceControl Id='MyServiceControl' Name='MyServiceForTest' Start='install' Stop='uninstall' Remove='uninstall'/>

But when I want to uninstall everything I get the error message: "The setup must update files or services that cannot be updated while the system is running. If you choose to continue, a reboot will be required to complete the setup.". If I manually stop the service before running the uninstaller I don't get this msg as both my service and my application aren't then running anymore.

In the log file I noticed that this happens in InstallValidate and I get this message b/c of MyApp.exe being running.

I think what happens is: the uninstallers checks the running applications, it notices that the MyService.exe and MyApp.exe are both running, detects probably that the MyService.exe will be stopped by the uninstaller itself as instructed, but doesn't know about the MyApp.exe that this one will also be terminated once the service will be stopped so it will show the reboot-message.

I can't just close MyApp.exe from uninstaller b/c the service will restart it again.

How could I solve this problem so that the user won't need to reboot or to manually stop the service before doing an uninstall/upgrade? Also, I can't change MyService and MyApp code anymore so I will have to do this from the (un)installer only.

TIA, Viv

A: 

I would expose a mechanism in your service in which your installer can instruct it to stand down and terminate the application. This way when Windows Installer costing looks for locked files it doesn't find any.

Christopher Painter
As said, I can't change anymore the code in the service.Could I actually have a Custom Action before InstallValidate that calls "net stop MyService"? Would this be correct? In this way I will stop the service before the installer looks for files in use.
Viv Coco
Good luck then. When developers tell me their code is 'done' and the installer just needs to 'make it work', things don't usually end well.
Christopher Painter