views:

227

answers:

2

I wrote a Windows Installer custom action based on the tutorial found here: http://www.codeproject.com/kb/install/msicustomaction.aspx

My custom action is killing a background process of a given name which could still be opened by the user. The reason is that I don't want users to see the warning that a given EXE is running and must be closed so that setup can continue. This works fine when the MSI passes through the UI sequence as the action is created in "InstallUISequence" table like in the tutorial.
However, when the MSI is used silently (right-click and select repair or uninstall), then my custom action isn't executed of course.

Where do I have to put my custom action so that it is executed immediately also when run silently?

I tried adding it to "InstallExecuteSequence", but the 'app running' warning is still shown. I then tried lowering the sequence number of my custom action to 5, but this also didn't help.

Note:
I'm using Orca to modify an MSI generated from a Visual Studio setup project. I'm then using the transform file to apply it.

A: 

You are rightly placed the custom action in the "InstallExecuteSequence". Who shows the "'app running' warning"? Did you verify that your custom action actually executed? Does Orca shows your custom action as first action in sequence? What says installation log?

VitalyVal
I'm guessing that'll be the standard "files in use" dialog thrown by Windows Installer during the UI sequence (before the Execute sequence has been processed)
sascha
+2  A: 

You need to schedule the action twice, once in the UI sequence and once in the Execute sequence, then schedule so it will only run in the first sequence that tries to execute it. (e.g. CustomAction/@execute='firstSequence' in WiX)

Update: If you're using Orca, then see the documentation on Custom Action Execution Scheduling Options, you'll just need to ensure that the msidbCustomActionTypeFirstSequence bit is set.

sascha
I'm sorry I don't know about WIX. I'm using Orca to generate a transform file which I apply afterwards to the generated MSI using a post build action in the Visual Studio setup project. I added the action in the UI sequence and in the Execute sequence. However I don't know how I can define 'firstSequence' using Orca.
Marc
@sascha: Thanks a lot! Using the MSDN documentation you linked to I found that I just needed to add 256 to my CustomAction.Type value. After entering 257 (1+256) there it now works just fine!
Marc

related questions