Merge pull request #64922 from akien-mga/dotnet-fix-app-host-version-detection

.NET: Change NETCore.App version detection to use highest match
This commit is contained in:
Rémi Verschelde 2022-08-27 18:58:40 +02:00 committed by GitHub
commit b5294b5759
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -153,6 +153,7 @@ def find_app_host_version(dotnet_cmd, search_version_str):
from distutils.version import LooseVersion from distutils.version import LooseVersion
search_version = LooseVersion(search_version_str) search_version = LooseVersion(search_version_str)
found_match = False
try: try:
env = dict(os.environ, DOTNET_CLI_UI_LANGUAGE="en-US") env = dict(os.environ, DOTNET_CLI_UI_LANGUAGE="en-US")
@ -172,7 +173,10 @@ def find_app_host_version(dotnet_cmd, search_version_str):
version = LooseVersion(version_str) version = LooseVersion(version_str)
if version >= search_version: if version >= search_version:
return version_str search_version = version
found_match = True
if found_match:
return str(search_version)
except (subprocess.CalledProcessError, OSError) as e: except (subprocess.CalledProcessError, OSError) as e:
import sys import sys