Skip to content

Instantly share code, notes, and snippets.

@bjh1977
Created March 26, 2018 15:00
Show Gist options
  • Save bjh1977/3e1cdac2ce8e60d3d7ab06f2b61069f5 to your computer and use it in GitHub Desktop.
Save bjh1977/3e1cdac2ce8e60d3d7ab06f2b61069f5 to your computer and use it in GitHub Desktop.
Install the latest version of Nuget to current user's temp folder
$InstallDir = join-path $env:temp 'Nuget'
if (Test-Path $InstallDir) {
Remove-Item -Path $InstallDir -Recurse -Force
}
New-Item -Path $InstallDir -ItemType Directory -Force | Out-Null
# grab nuget commandline from internet
$nugetURL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
Write-Verbose "Downloading nuget from $nugetUrl"
$wc = New-Object Net.WebClient
$wc.DownloadFile($nugetURL, "$InstallDir\nuget.exe")
$NugetFullPath = (Get-ChildItem -Path $InstallDir -Filter "nuget.exe" | Select-Object -ExpandProperty FullName -First 1)
Write-Host "Nuget path is $NugetFullPath"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment