Skip to content

Commit a754159

Browse files
committed
Set TLS 1.2 when downloading nuget.exe
1 parent 535ab4c commit a754159

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

build.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cd %~dp0
33

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

88
:part2
99
set EnableNuGetPackageRestore=true

build/downloadnuget.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Set-PSDebug -Trace 1
2+
[System.Net.ServicePointManager]::SecurityProtocol
3+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::TLS12
4+
[System.Net.ServicePointManager]::SecurityProtocol
5+
try
6+
{
7+
$client = New-Object System.Net.WebClient
8+
$client.DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '.nuget\NuGet.exe')
9+
}
10+
catch [System.Exception]
11+
{
12+
$Error[0].Exception.ToString()
13+
}

0 commit comments

Comments
 (0)