Created
April 1, 2015 12:34
-
-
Save DamianReeves/6d372c0cf80a7200033d to your computer and use it in GitHub Desktop.
Download NuGet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[string]$NuGetDir=".\.nuget\" | |
) | |
function Download-File { | |
param ( | |
[string]$url, | |
[string]$file | |
) | |
Write-Host "Downloading $url to $file" | |
$downloader = new-object System.Net.WebClient | |
$downloader.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials; | |
$downloader.DownloadFile($url, $file) | |
} | |
$Url = 'https://nuget.org/nuget.exe' | |
if(![System.IO.Directory]::Exists($NuGetDir)){ | |
[System.IO.Directory]::CreateDirectory($NuGetDir) | |
} | |
$File = Join-Path $NuGetDir "nuget.exe" | |
# download nuget | |
Download-File $url $file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SetLocal | |
SET ScriptDir=%~dp0 | |
SET NuGetDir=%ScriptDir%.nuget\ | |
SET NuGetPath=%NuGetDir%\nuget.exe | |
IF NOT EXIST %NuGetPath% ( | |
@echo "Downloading nuget.exe..." | |
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "& '.\Get-NuGet.ps1' '%NuGetDir%'" | |
) | |
if errorlevel 1 ( | |
exit /b %errorlevel% | |
) | |
%NuGetPath% %* | |
EndLocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment