kkrzyzak
Posts: 47
Joined: Wed Oct 13, 2010 2:10 pm

How to uninstall service before uninstall application?

Hi,
I create installer witch contains application and windows service. On install everything works great first of all AI install service, then start Install process odf app.
But I have problem to uninstall it. It says that service_name.exe can't be removed beacause it's in use. When i manulay stop service uninstall proces works OK.

So what should i do? Uninstall proces should first of all stop and deleta service and after that delete uninstall other components.

Best,
Karol
Last edited by kkrzyzak on Mon Apr 04, 2011 3:51 pm, edited 1 time in total.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: How to uninstall service beafore uninstall application?

Hi Karol,

This can be easily set from the Services page, using a control operation.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kkrzyzak
Posts: 47
Joined: Wed Oct 13, 2010 2:10 pm

Re: How to uninstall service beafore uninstall application?

Hi Bogdan,

I checked them from begining.(allready read this article).
But it doesnt't work. AI still try to delete file service.exe before stoping and deleting service.

Best,
Karol
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to uninstall service beafore uninstall application?

Hi Karol,

Here is an article which deals with a similar issue. Please use the advice my colleague Gabriel mentioned and let us know how it turned out.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kkrzyzak
Posts: 47
Joined: Wed Oct 13, 2010 2:10 pm

Re: How to uninstall service beafore uninstall application?

Hi Mihai,

I think it's very simillar but...
First of all I create test project witch contains only my service installation and it works good. (install and uninstall test project on the same PC as the main project).
Secound for now i do test only on winXP SP3.
So i think windows installer version doesn't metter. Other case you don't fixit since 2007?

After all i "solved" problem and write vbscript that clearly stops service

Code: Select all

option explicit
Dim objFSO
Set objFSO = CreateObject("WScript.Shell") 
objFSO.run("net stop ""ServiceName""")
I put it into "StopServices" Custom Action in Install Sequence.

After i stop service AI delete it without any problems.

I'm not happy with this solution and probably will not find the time to assert why it does not stop services in AI
As they say: "stopgap holds the longest!

If you have any ideas gladly try them.

Best,
Karol.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: How to uninstall service before uninstall application?

Hi Karol,

The "Stop" option on uninstall set on the service's control operation should work. Can you please send us a sample .AIP that reproduces this behavior and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”