Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MSBuild download task
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="">
<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<Url ParameterType="System.String" Required="true" />
<File ParameterType="System.String" Required="false" />
<OutputFolder ParameterType="System.String" Required="false" />
<Using Namespace="System.Web"/>
<Code Type="Fragment" Language="cs"><![CDATA[
using (var client = new System.Net.WebClient())
{ client.DownloadFile(Url, (OutputFolder != null ? OutputFolder + "/" : "") + (File ?? System.IO.Path.GetFileName(new Uri(Url).LocalPath))); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.