Skip to content

Commit

Permalink
Set TLS 1.2 when downloading nuget.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher committed Aug 31, 2020
1 parent 535ab4c commit a754159
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cd %~dp0

IF EXIST .nuget\NuGet.exe goto part2
echo Downloading latest version of NuGet.exe...
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "((new-object net.webclient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.nuget\NuGet.exe'))"
@powershell -NoProfile -ExecutionPolicy unrestricted -Command ".\build\downloadnuget.ps1"

:part2
set EnableNuGetPackageRestore=true
Expand Down
13 changes: 13 additions & 0 deletions build/downloadnuget.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Set-PSDebug -Trace 1
[System.Net.ServicePointManager]::SecurityProtocol
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::TLS12
[System.Net.ServicePointManager]::SecurityProtocol
try
{
$client = New-Object System.Net.WebClient
$client.DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.nuget\NuGet.exe')
}
catch [System.Exception]
{
$Error[0].Exception.ToString()
}

0 comments on commit a754159

Please sign in to comment.