@@ -589,11 +589,17 @@ function getDotNetVersion() {
589589 do
590590 if [[ ${line} == * ' Microsoft.NETCore.App ' * ]]; then
591591 dotnet_version=$( echo " $line }" | cut -d ' ' -f 2)
592+ # echo "GET: Found .NET runtime $dotnet_version" >&3
593+
592594 current_comparison=$( versionCompare $dotnet_version $highestDotNetVersion )
595+ # echo "GET: current compare ${comparison}, new compare ${current_comparison}" >&3
593596
594- if (( $current_comparison > $comparison )) ; then
597+ if (( $current_comparison >= $comparison )) ; then
595598 highestDotNetVersion=" $dotnet_version "
596599 comparison=$current_comparison
600+ # echo "GET: Found new highest .NET runtime $highestDotNetVersion" >&3
601+ # else
602+ # echo "GET: Found $dotnet_version runtime, which is not higher than $highestDotNetVersion" >&3
597603 fi
598604 fi
599605 done <<< " $(dotnet --list-runtimes)"
@@ -629,7 +635,7 @@ function setupDotNet () {
629635
630636 write " Checking for .NET ${requestedNetVersion} ..."
631637
632- currentDotNetVersion =" (None)"
638+ highestDotNetVersion =" (None)"
633639 comparison=-1
634640 haveRequested=false
635641
@@ -645,13 +651,18 @@ function setupDotNet () {
645651 dotnet_version=$( echo " $line }" | cut -d ' ' -f 1)
646652 dotnet_major_version=$( echo " $dotnet_version }" | cut -d ' .' -f 1)
647653
654+ # echo "SET: Found .NET SDK $dotnet_version" >&3
655+
648656 # Let's only compare major versions
649657 # current_comparison=$(versionCompare $dotnet_version $requestedNetVersion)
650658 current_comparison=$( versionCompare $dotnet_major_version $requestedNetMajorVersion )
651659
652660 if (( $current_comparison >= $comparison )) ; then
653- currentDotNetVersion =" $dotnet_version "
661+ highestDotNetVersion =" $dotnet_version "
654662 comparison=$current_comparison
663+ # echo "SET: Found new highest .NET SDK $highestDotNetVersion" >&3
664+ # else
665+ # echo "SET: Found $dotnet_version SDK, which is not higher than $requestedNetMajorVersion" >&3
655666 fi
656667
657668 # We found the one we're after
@@ -675,14 +686,20 @@ function setupDotNet () {
675686
676687 dotnet_version=$( echo " $line }" | cut -d ' ' -f 2)
677688 dotnet_major_version=$( echo " $dotnet_version }" | cut -d ' .' -f 1)
689+ # echo "SET: Found .NET runtime $dotnet_version" >&3
678690
679691 # Let's only compare major versions
680692 # current_comparison=$(versionCompare $dotnet_version $requestedNetVersion)
681693 current_comparison=$( versionCompare $dotnet_major_version $requestedNetMajorVersion )
694+ # echo "SET: current compare ${comparison}, new compare ${current_comparison}" >&3
682695
683696 if (( $current_comparison >= $comparison )) ; then
684- currentDotNetVersion =" $dotnet_version "
697+ highestDotNetVersion =" $dotnet_version "
685698 comparison=$current_comparison
699+
700+ # echo "SET: Found new highest .NET runtime $highestDotNetVersion" >&3
701+ # else
702+ # echo "SET: Found $dotnet_version runtime, which is not higher than $requestedNetMajorVersion" >&3
686703 fi
687704
688705 # We found the one we're after
@@ -696,18 +713,18 @@ function setupDotNet () {
696713
697714 mustInstall=" false"
698715 if [ " $haveRequested " == true ]; then
699- writeLine " All good. .NET ${requestedType} is ${currentDotNetVersion } " $color_success
716+ writeLine " All good. .NET ${requestedType} is ${highestDotNetVersion } " $color_success
700717 elif (( $comparison == 0 )) ; then
701- writeLine " All good. .NET ${requestedType} is ${currentDotNetVersion } " $color_success
718+ writeLine " All good. .NET ${requestedType} is ${highestDotNetVersion } " $color_success
702719 elif (( $comparison == - 1 )) ; then
703- writeLine " Upgrading: .NET ${requestedType} is ${currentDotNetVersion } . Upgrading to ${requestedNetVersion} " $color_warn
720+ writeLine " Upgrading: .NET ${requestedType} is ${highestDotNetVersion } . Upgrading to ${requestedNetVersion} " $color_warn
704721 mustInstall=true
705- else # (( $comparison == 1 )), meaning currentDotNetVersion > requestedNetVersion
722+ else # (( $comparison == 1 )), meaning highestDotNetVersion > requestedNetVersion
706723 if [ " $requestedType " = " sdk" ]; then
707724 writeLine " Installing .NET ${requestedType} ${requestedNetVersion} " $color_warn
708725 mustInstall=true
709726 else
710- writeLine " All good. .NET ${requestedType} is ${currentDotNetVersion } " $color_success
727+ writeLine " All good. .NET ${requestedType} is ${highestDotNetVersion } " $color_success
711728 fi
712729 fi
713730
@@ -722,8 +739,7 @@ function setupDotNet () {
722739 dotnet_path=" /opt/dotnet"
723740 elif [ " $os " = " linux" ]; then
724741 dotnet_path=" /usr/lib/dotnet/"
725- else
726- # dotnet_path="/usr/lib/dotnet/"
742+ else # macOS x64
727743 # dotnet_path="~/.dotnet/"
728744 dotnet_path=" /usr/local/share/dotnet/"
729745 fi
0 commit comments