diff options
Diffstat (limited to 'dir.targets')
-rw-r--r-- | dir.targets | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/dir.targets b/dir.targets new file mode 100644 index 0000000000..a5c1888f93 --- /dev/null +++ b/dir.targets @@ -0,0 +1,43 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + + <!-- Inline task to bootstrap the build to enable downloading nuget.exe --> + <UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll"> + <ParameterGroup> + <Address ParameterType="System.String" Required="true"/> + <FileName ParameterType="System.String" Required="true" /> + </ParameterGroup> + <Task> + <Reference Include="System" /> + <Code Type="Fragment" Language="cs"> + <![CDATA[ + var directory = System.IO.Path.GetDirectoryName(FileName); + System.IO.Directory.CreateDirectory(directory); + var client = new System.Net.WebClient(); + client.Proxy = System.Net.WebRequest.DefaultWebProxy; + client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials; + client.DownloadFile(Address, FileName); + ]]> + </Code> + </Task> + </UsingTask> + + <Target Name="_RestoreBuildTools" + BeforeTargets="Build" + Inputs="$(BuildToolsCoreCLRTargetInputs)" + Outputs="$(BuildToolsCoreCLRTargetOutputs)" + > + + <!-- Download latest nuget.exe --> + <DownloadFile + Condition="!Exists($(NuGetToolPath))" + Address="http://nuget.org/nuget.exe" + FileName="$(NuGetToolPath)" /> + + <!-- Restore build tools --> + <Exec + StandardOutputImportance="Low" + Command=""$(NuGetToolPath)" install " $(SourceDir).nuget\packages.config " -o " $(ToolsDir) " $(NuGetConfigCommandLine)" /> + + <Touch Files="$(BuildToolsInstallSemaphore)" AlwaysCreate="true" /> + </Target> +</Project>
\ No newline at end of file |