File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -499,11 +499,13 @@ function Receive-DotnetInstallScript
499
499
500
500
function Get-DotnetExe
501
501
{
502
- $discoveredDotNet = Get-Command - CommandType Application dotnet - ErrorAction SilentlyContinue
503
- if ( $discoveredDotNet ) {
504
- Write-Verbose - Verbose " Found dotnet here: $dotnetFoundPath "
505
- $script :DotnetExe = $discoveredDotNet
506
- return $discoveredDotNet
502
+ $discoveredDotnet = Get-Command - CommandType Application dotnet - ErrorAction SilentlyContinu
503
+ if ( $discoveredDotnet ) {
504
+ # it's possible that there are multiples. Take the highest version we find
505
+ $latestDotnet = $discoveredDotNet | Sort-object { [version ](& $_ -- version) } | Select-Object - Last 1
506
+ Write-Verbose - Verbose " Found dotnet here: $latestDotnet "
507
+ $script :DotnetExe = $latestDotnet
508
+ return $latestDotnet
507
509
}
508
510
# it's not in the path, try harder to find it
509
511
# check the usual places
You can’t perform that action at this time.
0 commit comments