@@ -589,11 +589,17 @@ function getDotNetVersion() {
589
589
do
590
590
if [[ ${line} == * ' Microsoft.NETCore.App ' * ]]; then
591
591
dotnet_version=$( echo " $line }" | cut -d ' ' -f 2)
592
+ # echo "GET: Found .NET runtime $dotnet_version" >&3
593
+
592
594
current_comparison=$( versionCompare $dotnet_version $highestDotNetVersion )
595
+ # echo "GET: current compare ${comparison}, new compare ${current_comparison}" >&3
593
596
594
- if (( $current_comparison > $comparison )) ; then
597
+ if (( $current_comparison >= $comparison )) ; then
595
598
highestDotNetVersion=" $dotnet_version "
596
599
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
597
603
fi
598
604
fi
599
605
done <<< " $(dotnet --list-runtimes)"
@@ -629,7 +635,7 @@ function setupDotNet () {
629
635
630
636
write " Checking for .NET ${requestedNetVersion} ..."
631
637
632
- currentDotNetVersion =" (None)"
638
+ highestDotNetVersion =" (None)"
633
639
comparison=-1
634
640
haveRequested=false
635
641
@@ -645,13 +651,18 @@ function setupDotNet () {
645
651
dotnet_version=$( echo " $line }" | cut -d ' ' -f 1)
646
652
dotnet_major_version=$( echo " $dotnet_version }" | cut -d ' .' -f 1)
647
653
654
+ # echo "SET: Found .NET SDK $dotnet_version" >&3
655
+
648
656
# Let's only compare major versions
649
657
# current_comparison=$(versionCompare $dotnet_version $requestedNetVersion)
650
658
current_comparison=$( versionCompare $dotnet_major_version $requestedNetMajorVersion )
651
659
652
660
if (( $current_comparison >= $comparison )) ; then
653
- currentDotNetVersion =" $dotnet_version "
661
+ highestDotNetVersion =" $dotnet_version "
654
662
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
655
666
fi
656
667
657
668
# We found the one we're after
@@ -675,14 +686,20 @@ function setupDotNet () {
675
686
676
687
dotnet_version=$( echo " $line }" | cut -d ' ' -f 2)
677
688
dotnet_major_version=$( echo " $dotnet_version }" | cut -d ' .' -f 1)
689
+ # echo "SET: Found .NET runtime $dotnet_version" >&3
678
690
679
691
# Let's only compare major versions
680
692
# current_comparison=$(versionCompare $dotnet_version $requestedNetVersion)
681
693
current_comparison=$( versionCompare $dotnet_major_version $requestedNetMajorVersion )
694
+ # echo "SET: current compare ${comparison}, new compare ${current_comparison}" >&3
682
695
683
696
if (( $current_comparison >= $comparison )) ; then
684
- currentDotNetVersion =" $dotnet_version "
697
+ highestDotNetVersion =" $dotnet_version "
685
698
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
686
703
fi
687
704
688
705
# We found the one we're after
@@ -696,18 +713,18 @@ function setupDotNet () {
696
713
697
714
mustInstall=" false"
698
715
if [ " $haveRequested " == true ]; then
699
- writeLine " All good. .NET ${requestedType} is ${currentDotNetVersion } " $color_success
716
+ writeLine " All good. .NET ${requestedType} is ${highestDotNetVersion } " $color_success
700
717
elif (( $comparison == 0 )) ; then
701
- writeLine " All good. .NET ${requestedType} is ${currentDotNetVersion } " $color_success
718
+ writeLine " All good. .NET ${requestedType} is ${highestDotNetVersion } " $color_success
702
719
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
704
721
mustInstall=true
705
- else # (( $comparison == 1 )), meaning currentDotNetVersion > requestedNetVersion
722
+ else # (( $comparison == 1 )), meaning highestDotNetVersion > requestedNetVersion
706
723
if [ " $requestedType " = " sdk" ]; then
707
724
writeLine " Installing .NET ${requestedType} ${requestedNetVersion} " $color_warn
708
725
mustInstall=true
709
726
else
710
- writeLine " All good. .NET ${requestedType} is ${currentDotNetVersion } " $color_success
727
+ writeLine " All good. .NET ${requestedType} is ${highestDotNetVersion } " $color_success
711
728
fi
712
729
fi
713
730
@@ -722,8 +739,7 @@ function setupDotNet () {
722
739
dotnet_path=" /opt/dotnet"
723
740
elif [ " $os " = " linux" ]; then
724
741
dotnet_path=" /usr/lib/dotnet/"
725
- else
726
- # dotnet_path="/usr/lib/dotnet/"
742
+ else # macOS x64
727
743
# dotnet_path="~/.dotnet/"
728
744
dotnet_path=" /usr/local/share/dotnet/"
729
745
fi
0 commit comments