Commits

Mauricio Scheffer  committed faca58f

Merged BuildMagicDownload and BuildMagicExtract tasks

  • Participants
  • Parent commits e007eaa

Comments (0)

Files changed (1)

File BuildMagic.targets

     <BuildDependsOn>BuildMagicRestore;$(BuildDependsOn)</BuildDependsOn>
   </PropertyGroup>
 
-  <UsingTask TaskName="BuildMagicDownload" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.v4.0.dll" >
+  <UsingTask TaskName="BuildMagicDownloadAndExtract" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.v4.0.dll" >
     <ParameterGroup>
       <Address ParameterType="System.String" Required="true" />
-      <DestinationFile ParameterType="System.String" Required="true" />
-    </ParameterGroup>
-    <Task>
-      <Code Type="Fragment" Language="cs">
-        <![CDATA[
-          using (var client = new System.Net.WebClient())
-          {
-            Directory.CreateDirectory(Path.GetDirectoryName(DestinationFile));
-            client.DownloadFile(Address, DestinationFile);
-            return true;
-          }
-        ]]>
-      </Code>
-    </Task>
-  </UsingTask>
-
-  <UsingTask TaskName="BuildMagicExtract" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.v4.0.dll" >
-    <ParameterGroup>
       <ZipFile ParameterType="System.String" Required="true" />
       <PathInZipFile ParameterType="System.String" Required="true" />
       <DestinationFile ParameterType="System.String" Required="true" />
       <Reference Include="WindowsBase" />
       <Code Type="Fragment" Language="cs">
         <![CDATA[
+          using (var client = new System.Net.WebClient())
+          {
+            Directory.CreateDirectory(Path.GetDirectoryName(ZipFile));
+            client.DownloadFile(Address, ZipFile);
+          }
           using (var pkg = System.IO.Packaging.ZipPackage.Open(ZipFile, FileMode.Open))
           {
             var part = pkg.GetParts().First(x => x.Uri.ToString() == PathInZipFile);
     <PropertyGroup>
       <BuildMagicNuGetZip>$(BuildMagicNuGetLocation).zip</BuildMagicNuGetZip>
     </PropertyGroup>
-    <BuildMagicDownload Address="$(BuildMagicNuGetUrl)" DestinationFile="$(BuildMagicNuGetZip)" />
-    <BuildMagicExtract ZipFile="$(BuildMagicNuGetZip)" PathInZipFile="/tools/NuGet.exe" DestinationFile="$(BuildMagicNuGetLocation)" />
+    <BuildMagicDownloadAndExtract Address="$(BuildMagicNuGetUrl)" ZipFile="$(BuildMagicNuGetZip)" PathInZipFile="/tools/NuGet.exe" DestinationFile="$(BuildMagicNuGetLocation)"/>
   </Target>
 
   <Target Name="BuildMagicRestore" Condition="Exists('$(BuildMagicPackagesConfig)')" DependsOnTargets="BuildMagicInstallNuget">