There isn't a built-in way to tell the uninstall that the ServiceControl that 
stops the service is going to shut down your app. That means you'll need to use 
an uninstall custom action to close down the app - I think WiX has one called 
CloseApp or something. You'd sequence this before InstallValidate, which is 
where the in-use situations are detected.  You also need a way to tell your 
service to switch off its monitoring, and use that in a custom action at 
uninstall time. I've seen this kind of situation before. There are times when 
these services need to be told to stop their monitoring, such as upgrades, 
patches, uninstalls, and when to start again. The way I've seen this done is 
that a registry entry is created/altered, and before the service does whatever 
it's going to do it checks the registry entry, so in your case the service 
wouldn't monitor the app. So your uninstall would, in this order. 

1. Have an uninstall custom action that writes a "stop monitoring" registry 
item for the service. 
2. A uninstall custom action (CloseApp?) that shuts down your app. 

InstallValidate finds no files in use and proceeds to stop services, uninstall 
files etc. 

3. Custom action to delete the "stop monitoring" registry item. 


Phil Wilson 


-----Original Message-----
From: Viv Coco [mailto:vcotirl...@hotmail.com] 
Sent: Wednesday, March 31, 2010 3:34 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] stop the service before uninstall

Forgot to mention: as my application is started by the service it runs 
in the service context which means they both don't run in the context of 
the current user, but as "SYSTEM". Also my application doesn't have a 
window (it's a winmain application but with 
EntryPointSymbol="mainCRTStartup").

I think the uninstaller checks at the beginning of the uninstalling 
process which binaries are in use and b/c MyApp.exe is at that point 
running I get the reboot message. If I could tell the installer to check 
the files in use at a later point, after the service was stopped (b/c at 
that point MyApp.exe is also not running anymore) I could get rid of 
this reboot-message. Can I schedule this check at a later point?

Thx,
Viv

On 3/31/2010 10:25 AM, Viv Coco wrote:
>>  When, during the uninstall process, are you getting the error? Is it
> happening during the RemoveFiles action?
>
> If I have correctly read the log file, happens during the 
> InstallValidate (I checked in the log file the "Doing action:" and 
> InstallValidate  is the last one before the message is shown).
>
> But in the log file I noticed that it's not my service that actually 
> produces the problem, but my application. I have an application 
> (MyApp.exe) that runs endlessly and is babysit by a service 
> (MyServiceWatchdog.exe): when the service is started my application is 
> started, when the service is stopped my application is stopped (the 
> service takes care of startig/stopiing my application) .
> So in the (un)installer I said that the service must be stopped when 
> uninstalling which will actually stop also my application (b/c my 
> service will also kill my app when stopping).
>
> I'm not sure if I understood correctly but what I think happens is: 
> the uninstaller checks the files and sees that my application 
> (MyApp.exe) is running and there is no event scheduled to stop it, so 
> it shows the reboot message. But actually MyApp.exe will be stopped 
> once the service is stopped.
> Is there a way to "tell" the uninstaller that? I can't kill MyApp.exe 
> from the uninstaller b/c if the service is not yet stopped when 
> MyApp.exe is killed, the service will restart again MyApp.exe.
>
>>  If so, you might try adding the Wait="yes" attribute to your 
>> ServiceControl so that it waits for it to stop
> the service before moving on to remove files. It may be that the SCM is
> taking too long and the installer need to give it time to complete. 
> Just a
> guess, though.
>
> I tried with the Wait attribute but didn't change the behavior.
>
>>  Could you provide a log?
>
> sure, see attached. I saved the log as soon as I got the reboot message.
>
> Thanks a lot!
> Viv
>
>
>
> On 3/30/2010 1:55 PM, Nick Ramirez wrote:
>> When, during the uninstall process, are you getting the error? Is it
>> happening during the RemoveFiles action? If so, you might try adding the
>> Wait="yes" attribute to your ServiceControl so that it waits for it 
>> to stop
>> the service before moving on to remove files. It may be that the SCM is
>> taking too long and the installer need to give it time to complete. 
>> Just a
>> guess, though. Could you provide a log?
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
>
>
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>    

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


*** Confidentiality Notice: This e-mail, including any associated or attached 
files, is intended solely for the individual or entity to which it is 
addressed. This e-mail is confidential and may well also be legally privileged. 
If you have received it in error, you are on notice of its status. Please 
notify the sender immediately by reply e-mail and then delete this message from 
your system. Please do not copy it or use it for any purposes, or disclose its 
contents to any other person. This email comes from a division of the Invensys 
Group, owned by Invensys plc, which is a company registered in England and 
Wales with its registered office at Portland House, Bressenden Place, London, 
SW1E 5BF (Registered number 166023). For a list of European legal entities 
within the Invensys Group, please go to 
http://www.invensys.com/legal/default.asp?top_nav_id=77&nav_id=80&prev_id=77. 
You may contact Invensys plc on +44 (0)20 7821 3848 or e-mail 
inet.hqhelpd...@invensys.com. This e-mail and any attachments thereto may be 
subject to the terms of any agreements between Invensys (and/or its 
subsidiaries and affiliates) and the recipient (and/or its subsidiaries and 
affiliates).



------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to