This project is read-only.

Web.AppPool.Exists and Web.WebSite.Exists output parameters not set

May 9, 2008 at 9:15 PM

I'm trying to use the tasks Web.AppPool.Exists and Web.WebSite.Exists, but it seems like the output parameters are not getting set correctly. Below are snippets from the target.

<Web.AppPool.Exists AppPoolName="MyAppPool">
<Output TaskParameter="DoesExist" PropertyName="AppPoolExists" />
<Message Text="$('AppPoolExists')" />
<Web.WebSite.Exists Description="MyWebSite">
<Output TaskParameter="DoesExist" PropertyName="WebSiteExists" />
<Message Text="$('WebSiteExists')" />

When the target is run, the Web.AppPool.Exists does not output anything suggesting that it even ran nor does the message task output anything. Web.WebSite.Exists on the other hand outputs "Checking for Existance website 'MyWebSite' on: localhost". But then the message task outputs nothing. Has anyone else successfully run these tasks?

Any help would be appreciated.
May 10, 2008 at 10:04 AM
CodePlex was updated last night and along with a few nice features, the ability to create a workitem from a discussion appears to have gone. Not nice... back to your problem:

If you just run your sample with normal diagnostics, the output is pretty basic:

Target Default:
Checking for Existance website 'MyWebSite' on: localhost

Behind the covers, a lot has actually happened, and this is where upping the diagnostics helps. Simply add /v:diag to your command line call:

Target "Default" in file "C:\a\Copy of SDCAppPool.proj":


  Using "Web.AppPool.Exists" task from assembly "C:\a\Microsoft.Sdc.Tasks.dll".

  Task "Web.AppPool.Exists"

  Done executing task "Web.AppPool.Exists".

  Using "Message" task from assembly "Microsoft.Build.Tasks, Version=, Cu

lture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

  Task "Message"

  Done executing task "Message".

  Using "Web.WebSite.Exists" task from assembly "C:\a\Microsoft.Sdc.Tasks.dll".

  Task "Web.WebSite.Exists"

    Checking for Existance website 'MyWebSite' on: localhost

  Done executing task "Web.WebSite.Exists".

  Task "Message"

  Done executing task "Message".

Done building target "Default" in project "Copy of SDCAppPool.proj".


So as you can see, all the expected tasks are executing. There are two problems in this case.


  1. The first 'problem' is that the SDC task for checking the AppPool existence is not emitting any basic messages (I'll fix this in the next release).
  2. The second problem is in your code. You appear to have some apostrophes in your property names, simply remove those and you will get the boolean results out.


<Message Text="$('AppPoolExists')" />
<Message Text="$('WebSiteExists')" />

should read

<Message Text="$(AppPoolExists)" />
<Message Text="$(WebSiteExists)" />

Running the corrected code on an updated build, I get:

Target Default:

    Checking whether AppPool: MyAppPool exists on: localhost


    Checking for Existence website 'MyWebSite' on: localhost


Hope that helps.


May 10, 2008 at 10:10 AM

May 12, 2008 at 2:39 PM
I had been staring at this task for so long, I overlooked the apostrophes.  Thanks for your help.
Dec 24, 2008 at 5:15 PM
The property value is not available for access outside the target where it is set. For e.g.,


Target Name="CheckAppServerPoolExists">



Condition="$(AppServerPoolExists) == False"-->













Output TaskParameter="DoesExist" PropertyName="AppServerPoolExists"/>






Message Text="Exists: $(AppServerPoolExists)"/> <!--I'm getting the right value here which is false in my case-->



CallTarget Targets="CreateAppServerAppPool"/>






Target Name="CreateAppServerAppPool">



    <Message Text="Inside: $(AppServerPoolExists)"/> <!--I'm not getting the value of the property AppServerPoolExists here which is set in the target shown above..It is always empty here..Is this a scope issue?-->




Any help is appreciated!!!