Merge branch 'fix_dotnet_version_detection' of https://github.com/Weyzu/FlaxEngine into Weyzu-fix_dotnet_version_detection

This commit is contained in:
Wojtek Figat
2025-06-01 22:43:53 +02:00

View File

@@ -283,8 +283,10 @@ namespace Flax.Build
Log.Verbose($"Found the following .NET SDK versions: {string.Join(", ", dotnetSdkVersions)}"); Log.Verbose($"Found the following .NET SDK versions: {string.Join(", ", dotnetSdkVersions)}");
Log.Verbose($"Found the following .NET runtime versions: {string.Join(", ", dotnetRuntimeVersions)}"); Log.Verbose($"Found the following .NET runtime versions: {string.Join(", ", dotnetRuntimeVersions)}");
string configuredDotnetVersion = Configuration.Dotnet;
var dotnetSdkVersion = GetVersion(dotnetSdkVersions); var dotnetSdkVersion = GetVersion(dotnetSdkVersions);
var dotnetRuntimeVersion = GetVersion(dotnetRuntimeVersions); var dotnetRuntimeVersion = GetVersion(dotnetRuntimeVersions);
if (!string.IsNullOrEmpty(dotnetSdkVersion) && !string.IsNullOrEmpty(dotnetRuntimeVersion) && ParseVersion(dotnetRuntimeVersion).Major > ParseVersion(dotnetSdkVersion).Major) if (!string.IsNullOrEmpty(dotnetSdkVersion) && !string.IsNullOrEmpty(dotnetRuntimeVersion) && ParseVersion(dotnetRuntimeVersion).Major > ParseVersion(dotnetSdkVersion).Major)
{ {
// Make sure the reference assemblies are not newer than the SDK itself // Make sure the reference assemblies are not newer than the SDK itself
@@ -296,21 +298,24 @@ namespace Flax.Build
} while (!string.IsNullOrEmpty(dotnetRuntimeVersion) && ParseVersion(dotnetRuntimeVersion).Major > ParseVersion(dotnetSdkVersion).Major); } while (!string.IsNullOrEmpty(dotnetRuntimeVersion) && ParseVersion(dotnetRuntimeVersion).Major > ParseVersion(dotnetSdkVersion).Major);
} }
var minVer = string.IsNullOrEmpty(Configuration.Dotnet) ? MinimumVersion.ToString() : Configuration.Dotnet;
if (string.IsNullOrEmpty(dotnetSdkVersion)) if (string.IsNullOrEmpty(dotnetSdkVersion))
{ {
if (dotnetSdkVersions.Any()) string installedVersionsText = dotnetSdkVersions.Any()
Log.Warning($"Unsupported .NET SDK versions found: {string.Join(", ", dotnetSdkVersions)}. Minimum version required is .NET {minVer}."); ? $"{string.Join(", ", dotnetSdkVersions)}"
else : "None";
Log.Warning($"Missing .NET SDK. Minimum version required is .NET {minVer}."); Log.Warning(!string.IsNullOrEmpty(configuredDotnetVersion)
? $"Configured .NET SDK '{configuredDotnetVersion}' not found. Installed versions: {installedVersionsText}."
: $"No compatible .NET SDK found within the supported range: .NET {MinimumVersion.ToString()} - {MaximumVersion.ToString()}. Installed versions: {installedVersionsText}.");
return; return;
} }
if (string.IsNullOrEmpty(dotnetRuntimeVersion)) if (string.IsNullOrEmpty(dotnetRuntimeVersion))
{ {
if (dotnetRuntimeVersions.Any()) string installedRuntimeVersionsText = dotnetRuntimeVersions.Any()
Log.Warning($"Unsupported .NET runtime versions found: {string.Join(", ", dotnetRuntimeVersions)}. Minimum version required is .NET {minVer}."); ? $"{string.Join(", ", dotnetRuntimeVersions)}"
else : "None";
Log.Warning($"Missing .NET runtime. Minimum version required is .NET {minVer}."); Log.Warning(!string.IsNullOrEmpty(configuredDotnetVersion)
? $"Configured .NET runtime version '{configuredDotnetVersion}' not found. Installed versions: {installedRuntimeVersionsText}."
: $"No compatible .NET runtime found within the supported range: .NET {MinimumVersion.ToString()} - {MaximumVersion.ToString()}. Installed versions: {installedRuntimeVersionsText}.");
return; return;
} }
RootPath = dotnetPath; RootPath = dotnetPath;