File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2196,7 +2196,19 @@ function Start-PSBootstrap {
2196
2196
2197
2197
function Get-LatestInstalledSDK {
2198
2198
Start-NativeExecution - sb {
2199
- dotnet -- list- sdks | Select-String - Pattern ' \d*.\d*.\d*(-\w*\.\d*.\d*.\d*)?' | ForEach-Object { [System.Management.Automation.SemanticVersion ]::new($_.matches.value ) } | Sort-Object - Descending | Select-Object - First 1
2199
+ dotnet -- list- sdks | ForEach-Object {
2200
+ # this splits strings like
2201
+ # '6.0.202 [C:\Program Files\dotnet\sdk]'
2202
+ # '7.0.100-preview.2.22153.17 [C:\Users\johndoe\AppData\Local\Microsoft\dotnet\sdk]'
2203
+ # into version and path parts.
2204
+ $version , $null = $_ -split ' \s' , 2
2205
+ try {
2206
+ [System.Management.Automation.SemanticVersion ]::new($version )
2207
+ }
2208
+ catch {
2209
+ Write-Warning - Message " Unable to parse dotnet version semantically: $version "
2210
+ }
2211
+ } | Sort-Object - Descending | Select-Object - First 1
2200
2212
} - IgnoreExitcode 2> $null
2201
2213
}
2202
2214
You can’t perform that action at this time.
0 commit comments