WaitForApplicationExitProcessor no working

Topics: Updater Application Block
Aug 25, 2005 at 2:55 AM
originally posted by: cubaman

I have configured an aplication to use the UAB. I'm cheching for updates from the same app in another thread. It gets the updates fine from the server and process it. Finally i use the WaitForApplicationExitProcessor and the ApplicationDeployProcessor to wait for the app to exit before deploy. But nothing happens!!! I'm still having the old version after the app close. Any ideas? I have found also an error in the event log, included here. I'm using windows 2000 pro as OS. Here is my config file.

Thanks!!
----------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-16"?>
<manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" manifestId="{00098955-4f65-469a-8576-61f8ef505772}" mandatory="No" xmlns="urn:schemas-microsoft-com:PAG:updater-application-block:v2:manifest">
<description>Actualizacon de prueba</description>
<application applicationId="215E1AD7-9ABA-432f-A952-24BABA556850">
<entryPoint file="OldVersion.exe" />
<location>D:\OldVersion\Upd</location>
</application>
<files base="http://localhost/OldVersionUpd" hashComparison="No">
<file source="OldVersion.exe" transient="No" />
</files>
<downloader name="BitsDownloader" />
<activation>
<tasks>
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.WaitForApplicationExitProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="WaitForApplicationExitProcessor" processName="OldVersion.exe" />
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.WaitForApplicationExitProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="ApplicationDeployProcessor" processName="OldVersion.exe" />
</tasks>
</activation>
</manifest>

This is the error founded in the event log, don't know if have something to do with it, but i know that enterprise library uses the services of the queue service.
-----------------------------------------------------------------------------------
The Open Procedure for service "MSMQ" in DLL "C:\WINNT\system32\MQPERF.DLL" failed. Performance data for this service will not be available. Status code returned is data DWORD 0.
Aug 25, 2005 at 6:48 AM
originally posted by: lottoman2000

Hi Cubaman,

Try not including the .exe in the process name (ie. OldVersion). Where is OldVersion.exe located? Is it D:\OldVersion\ or D:\OldVersion\Upd ? If it is in D:\OldVersion\ I think you need to change the location to D:\OldVersion\. Take a look into the downloader folder to you see you new OldVersion.exe there? if yes then the program is downloading no problem.

Also take a look at your code, Are you activiting the the updates (ie calling updater.Activate(manifests))? Is your code reaching that line?

This is a copy of one of the manifests that worked for me:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" manifestId="{a001fd81-6519-41ab-b831-6bbd3480042e}" mandatory="No" xmlns="urn:schemas-microsoft-com:PAG:updater-application-block:v2:manifest">
<description>Controls</description>
<application applicationId="(189755EE-CD65-4AEE-A0C0-3E9FA56D3862)">
<entryPoint file="UABScenario2.exe" />
<location>.\</location>
</application>
<files base="http://localhost/UABScenario2/" hashComparison="No">
<file source="Control.dll" transient="No" />
</files>
<activation>
<tasks>
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.ApplicationDeployProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="ApplicationDeployProcessor" />
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.WaitForApplicationExitProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="WaitForApplicationExitProcessor" processName="UABScenario2" />
</tasks>
</activation>
<includedManifests>
<manifest location="reports.xml" manifestId="{8512407d-45ee-456c-ade1-4c91c0200b32}" />
<manifest location="config.xml" manifestId="{014ef4e4-c8ab-4ec3-924a-a7a2500d61d0}" />
</includedManifests>
</manifest>

Good luck
Aug 25, 2005 at 11:13 PM
originally posted by: cubaman

Hello, and thanks for answering!
The app is located at D:\OldVersion\. Anytimes the app executes it gets fine the file, i can see it in the download folder. The problem is with WaitForApplicationExitProcessor. It doesn't copy the file. I haven't see any bat file executed as expected once the app exits. I discovered that if i change the name to the file in the ApplicationDeployProcessor from Oldversion.exe to whatever it is copied fine in the rigth folder. So my problem is with WaitForApplicationExitProcessor no working at all, no even exceptions are thrown.
Any other sugestion??
Thanks, best regards.
Aug 26, 2005 at 3:27 AM
originally posted by: lottoman2000

Have you tried changing the process name to OldVersion instead of OldVersion.exe?
Aug 27, 2005 at 3:06 AM
originally posted by: cubaman

Yes, i have tried this posibility too. The problem is when activating the task, in class WaitForApplicationExitProcessor, method Init :
/// <summary>
/// Initializes the processor using the manifest configuration and the UpdaterTask instance.
/// </summary>
/// <param name="config">The configuration for the processor in the manifest file.</param>
/// <param name="task">The UpdaterTask instance.</param>
public void Init(ActivationProcessorProviderData config, UpdaterTask task)
{
taskToProcess = task;

if ( config.AnyAttributes != null )
{
foreach( XmlAttribute attr in config.AnyAttributes )
{
if ( String.Compare( attr.Name, "processName", false, CultureInfo.InvariantCulture ) == 0 )
{
processName = attr.Value; // This value is always ""
}
}
}
}

attr.Value is always "" so, finally the application doesn't get updated.

Also i found that in class WaitForApplicationExitProcessor the method GetProcessIdToWaitFor() doesn't get the app Id cause process name is "". . Then it returns -1 to the method PrepareExecution(). It asumes that the app is not running and then give the update process as completed. Any other hint??
Thanks a lot!
Oscar Acosta
Aug 27, 2005 at 6:29 AM
originally posted by: lottoman2000

I think I know whats going on. You do not have a deploy processor.

This is part of your manifest:

type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.WaitForApplicationExitProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="WaitForApplicationExitProcessor" processName="OldVersion.exe" />
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.WaitForApplicationExitProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="ApplicationDeployProcessor" processName="OldVersion.exe" />

You named the second processor "ApplicationDeployProcessor" but the type is still "WaitForApplicationExitProcessor".

to get it to work you need a WaitForApplicationExitProcessor and ApplicationDeployProcessor. The following is part of my manifest:

<tasks>
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.ApplicationDeployProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="ApplicationDeployProcessor" />
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.WaitForApplicationExitProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="WaitForApplicationExitProcessor" processName="UABScenario2" />
</tasks>

Notice that I have two differet types.

Try that and let me know.
Aug 29, 2005 at 9:55 PM
originally posted by: cubaman

Yes! You were right, thanks, even if i'm still frustrated. I added the application deploy processor to the xml file, but still not working. I think there should be a path problem. I have the app in C:\UpdateTest\OldVersion.exe The downloaded files are been copied in C:\UpdateTest\Upd. In the location property of the manifest i have tried everything, but the new exe is not been copied. Now i can see the bat file executing, and it closes when the app exits, but it just delete itself and other exe(PostApplicationExitActivationProcess.exe) without copying anything. It can't be so hard! Here is the new manifest, perhaps you can bring some ligth again about the Location property of the manifest or some other mistake i could make.
Thanks a lot again!!
<?xml version="1.0" encoding="utf-16"?>
<manifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" manifestId="{e342e914-1973-4ccf-8171-4dfda3f4c34e}" mandatory="Yes" xmlns="urn:schemas-microsoft-com:PAG:updater-application-block:v2:manifest">
<description>Actualizacion de prueba</description>
<application applicationId="215E1AD7-9ABA-432f-A952-24BABA556850">
<entryPoint file="OldVersion.exe" />
<location>.\</location>
</application>
<files base="http://localhost/OldVersionUpd" hashComparison="No">
<file source="OldVersion.exe" transient="No" />
<file source="OldVersion.exe.config" transient="No" />
</files>
<downloader name="BitsDownloader" />
<activation>
<tasks>
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.WaitForApplicationExitProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="WaitForApplicationExitProcessor" processName="OldVersion" />
<task type="Microsoft.ApplicationBlocks.Updater.ActivationProcessors.ApplicationDeployProcessor, Microsoft.ApplicationBlocks.Updater.ActivationProcessors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="ApplicationDeployProcessor" />
</tasks>
</activation>
</manifest>
Sep 7, 2005 at 8:34 AM
originally posted by: depictureboy

I am having problems with it too. but I think I see your issue. In the other posters code the deployment processor was first. In yours it is after the wait for exit processor...