Make an HTTP request from MSBuild script

I use the MSBuild Community Tasks a lot. They add extra tasks for MSBuilds. In there is a HttpRequest task which, from the look of it, does what you want.

<HttpRequest Url="http://<mydomain.com>/index.php?checkdb=1" 
                EnsureResponseContains="Database upgrade check completed successfully." 
                FailOnNon2xxResponse="true" />

Hope this helps


In version 4 of the MSBuild Community Tasks, the HttpRequest task was replaced by HttpWebRequest with a different syntax:

<MSBuild.ExtensionPack.Web.HttpWebRequest
        TaskAction="GetResponse" Url="http://www.freetodev.com">
    <Output TaskParameter="Response" ItemName="ResponseDetail"/>
    <Output TaskParameter="Status" PropertyName="ResponseStatus"/>
</MSBuild.ExtensionPack.Web.HttpWebRequest>

Tags:

Msbuild