7
votes

I have an installer that installs few components including windows service, after it installed it'll start the service that installed onto the system using CustomAction.

The problem when I uninstall the application, the installer asks to close the application before continue.

Error Dialog

I created a custom action that will stop the service, and I scheduled it with Uninstall actions.

But its not executed until I press OK for the error dialog after manually stop the service.

It failed on Win7, but I tested the same MSI on WinXP and worked fine (The custom action executed before checking the file In-use)!!!

I'm using VS2010 setup project to create the installer, but I don't have problem to modify it (using Orca for example) after build.

Here is the content of the InstallExecuteSequence Table :

enter image description here

I found that the InstallValidate action that check for In-Use files, but I can't sequence my custom action that stop the service before it because its before InstallInitialize action that require all custom actions to be after it (ICE77 Evaluator)

ICE77 posts an error if an in-script custom action is sequenced before the InstallInitialize action or after the InstallFinalize action.

What should I do, shall I use the MSIRESTARTMANAGERCONTROL property that specifies whether the Windows Installer package uses the FilesInUse Dialog functionality, but I need to notify the user about the other in-use files.

1
I face the same issue with windows installer in VS2015. How did you get rid off this?RJN
You need to apply the answer below, but because you're using VS installer project, you won't be able to automatically add that row to that table. I'd suggest to create a post-build action to execute -for example- a JScript file that insert that row manually (check stackoverflow.com/questions/8318920/…) for a sample row insertionAmer Sawan

1 Answers

2
votes

There are built-in features for this in Windows Installer - no custom action necessary. In fact I would strongly advice against using a custom action for this unless your service is very special (for example, slow to stop, or in need of shutting down a lot of resources and you need to verify that it does so). Most normal services stop within half a minute or so. I am not sure how long the Windows Installer Engine is configured to wait for the service to stop.

The ServiceControl table of MSI is the "under the hood" feature for this. Most installation tools provide wizard like or GUI elements to control this in a simpler fashion though.

Here is the service control view in one Installshield version:

enter image description here