WebClient Class

MSBuild Extension Pack

WebClient Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

DownloadFile (Required: Url, FileName Optional:Proxy, BypassOnLocalOutput: Response)

OpenRead (Required: Url Optional: DisplayToConsole, Proxy, BypassOnLocalOutput: Data)

Remote Execution Support: NA

Inheritance Hierarchy

SystemObject  Microsoft.Build.UtilitiesTask
    MSBuild.ExtensionPackBaseTask
      MSBuild.ExtensionPack.WebWebClient

Namespace: MSBuild.ExtensionPack.Web
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

The WebClient type exposes the following members.

Constructors

  NameDescription
Public methodWebClient
Top
Properties

  NameDescription
Public propertyBypassOnLocal
Sets whether to bypass the proxy for local addresses. Default is false.
Public propertyData
Gets the Data downloaded.
Public propertyDisplayToConsole
Sets whether to show Data to the console. Default is false.
Public propertyFileName
Sets the name of the file
Public propertyProxy
Sets the URI of a proxy
Public propertyUrl
Sets the name of the Url. Required.
Top
Examples

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
        <!-- Download a File-->
        <MSBuild.ExtensionPack.Web.WebClient TaskAction="DownloadFile" Url="http://hlstiw.bay.livefilestore.com/y1p7GhsJWeF4ig_Yb-8QXeA1bL0nY_MdOGaRQ3opRZS0YVvfshMfoZYe_cb1wSzPhx4nL_yidkG8Ji9msjRcTt0ew/Team%20Build%202008%20DeskSheet%202.0.pdf?download" FileName="C:\TFS Build 2008 DeskSheet.pdf"/>
        <!-- Download a File using a proxy to connect to the remote server -->
        <MSBuild.ExtensionPack.Web.WebClient TaskAction="DownloadFile" Url="http://download.sysinternals.com/Files/SysinternalsSuite.zip" FileName="MySysinternalsCopy.zip" Proxy="myproxy.fabrikam.com:8080"/>
        <!-- Get the contents of a Url-->
        <MSBuild.ExtensionPack.Web.WebClient TaskAction="OpenRead" Url="http://www.msbuildextensionpack.com">
            <Output TaskParameter="Data" PropertyName="Out"/>
        </MSBuild.ExtensionPack.Web.WebClient>
        <Message Text="$(Out)"/>
    </Target>
</Project>
See Also

Reference