File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,18 +86,33 @@ jobs:
8686 - name : Install .NET SDK for matrix
8787 shell : pwsh
8888 run : |
89- $v = "${{ matrix.sdk }}" # e.g. "8.0.x" or "9.0.x"
89+ # Derive SDK version from framework
90+ $v = "${{ matrix.framework }}" # e.g. "net472" or "net8.0"
9091
92+ if ($fw -like "net8.*") {
93+ $v = "8.0.x"
94+ }
95+ elseif ($fw -like "net9.*") {
96+ $v = "9.0.x"
97+ }
98+ else {
99+ $v = "9.0.x"
100+ }
101+
102+ # Ensure modern TLS for Invoke-WebRequest (GHA runners sometimes default to TLS 1.0/1.1)
91103 [Net.ServicePointManager]::SecurityProtocol =
92104 [Net.SecurityProtocolType]::Tls12 -bor
93105 [Net.SecurityProtocolType]::Tls13
94106
107+ # Download latest install-dotnet.ps1
95108 $installScript = "$env:RUNNER_TEMP\install-dotnet.ps1"
96109 Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript
97110
111+ # Install SDK to a private folder
98112 $sdkDir = "$env:RUNNER_TEMP\dotnet-$v"
99113 & pwsh $installScript -Version $v -InstallDir $sdkDir -NoPath
100114
115+ # Make that dotnet first on PATH
101116 echo $sdkDir | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
102117
103118 - name : Cache NuGet Packages
You can’t perform that action at this time.
0 commit comments