MsiProcessor and PostApplicationExitActivationProc

Topics: Updater Application Block
Oct 19, 2005 at 8:42 AM
originally posted by: lbagnall

Here's the scenario. I have an application that is trying to automatically update itself in process.
The update is based on Windows Installer. I don't have a patch file, so I am running three tasks,
first WaitForApplicationExitProcessor, then MsiProcessor with installType=Remove, then MsiProcessor
with installType=Install.

<tasks>
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.WaitForApplicationExitProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors" name="WaitForApplicationExitProcessor" />
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.MsiProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="UninstallPrevious">
<config xmlns="">
<installType>Remove</installType>
<uiLevel>msiUILevelFull</uiLevel>
<propertyValues>REMOVE=ALL</propertyValues>
<productCode>{A080D95A-88F3-432b-A434-ED76D7D5B3BA}</productCode>
</config>
</task>
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.MsiProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="InstallNew">
<config xmlns="">
<installType>Install</installType>
<uiLevel>msiUILevelFull</uiLevel>
<packagePath>MyProduct.msi</packagePath>
<propertyValues>ACTION=INSTALL</propertyValues>
</config>
</task>
</tasks>

The problem is that PostApplicationExitActivationProcess.exe is written out to the same folder as my
executable, and it loads a number of DLL's that are also used by my executable, namely

Interop.WindowsInstaller.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.ApplicationBlocks.Updater.dll
Microsoft.ApplicationBlocks.Updater.Downloaders.dll
Microsoft.Practices.EnterpriseLibrary.Configuration.dll
Microsoft.ApplicationBlocks.Updater.ActivationProcessors.dll

When it tries to run my uninstaller, the uninstaller attempts to delete these six files, and puts up
a dialog that says "The following applications should be closed before continuing the install:"
If I enable detailed logging, I see the following in my log file

MSI (s) (84:A8) 13:16:09:578: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1603
Info 1603. The file C:\Program Files\MyCompany\MyProduct\Interop.WindowsInstaller.dll is being held in use by the following process: Name: PostApplicationExitActivationProcess, Id: 3452, Window Title: '(not determined yet)'. Close that application and retry.
etc...

I can't figure out a way to work around this.

Any suggestions?
Oct 21, 2005 at 3:12 AM
originally posted by: puy0

Simple way : I don't know if you can do something like telling msi to ignore this.

Hard way (but not too hard) : You can take the code of the PostExitApplication, which is simple, and write a new Processor that copy PostApplicationExitActivationProcess in a subdir with appropriates .dll to avoid locking...

Just an idea.
Maybe stupid.
Have fun.