@@ -41,14 +41,10 @@ if ($null -eq $env:TEAMCITY_VERSION -and $null -ne (Get-Command "dotnet" -ErrorA
4141}
4242else {
4343 # Download install script
44- # Octopus modification to comment out the download of the install script
45- # $DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
46- # New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
47- # [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
48- # (New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
49-
50- # Octopus modification to use version of the script configured to support TLS 1.2
51- $DotNetInstallFile = Join-Path $PSScriptRoot " dotnet-install.ps1"
44+ $DotNetInstallFile = " $TempDirectory \dotnet-install.ps1"
45+ New-Item - ItemType Directory - Path $TempDirectory - Force | Out-Null
46+ [Net.ServicePointManager ]::SecurityProtocol = [Net.SecurityProtocolType ]::Tls12
47+ (New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl , $DotNetInstallFile )
5248
5349 # If global.json exists, load expected version
5450 if (Test-Path $DotNetGlobalFile ) {
@@ -61,9 +57,13 @@ else {
6157 # Install by channel or version
6258 $DotNetDirectory = " $TempDirectory \dotnet-win"
6359 if (! (Test-Path variable:DotNetVersion)) {
64- ExecSafe { & powershell $DotNetInstallFile - InstallDir $DotNetDirectory - Channel $DotNetChannel - NoPath }
60+ # Octopus Modification to ensure TLS1.2 is enabled within the script
61+ # See https://github.com/dotnet/install-scripts/issues/362
62+ ExecSafe { & powershell - NoProfile - ExecutionPolicy unrestricted - Command " [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath" }
6563 } else {
66- ExecSafe { & powershell $DotNetInstallFile - InstallDir $DotNetDirectory - Version $DotNetVersion - NoPath }
64+ # Octopus Modification to ensure TLS1.2 is enabled within the script
65+ # See https://github.com/dotnet/install-scripts/issues/362
66+ ExecSafe { & powershell - NoProfile - ExecutionPolicy unrestricted - Command " [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath" }
6767 }
6868 $env: DOTNET_EXE = " $DotNetDirectory \dotnet.exe"
6969}
0 commit comments