cake-build / resources

Contains different kind of resources such as bootstrappers and configuration files.
MIT License
54 stars 79 forks source link

TLS 1.2 for dotnet-install.ps1 #59

Closed patriksvensson closed 6 years ago

patriksvensson commented 6 years ago

@SharpeRAD commented on Fri Jul 27 2018

Just an FYI that I started to receive this exception on our build server this morning:

 (New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUr ...  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException
The term 'C:\Tools\DotNet\dotnet-install.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

I had a hunch it was due to TLS changes on the download server and appended this line to the powershell script which solved the issue:

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;

Could be worth adding it to the default script as its a quick fix. Keep up the awesome work 🍰 team.