From 32b4efc17562ab3fe43957004236b0b3d974670c Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Fri, 24 Oct 2025 23:20:07 +0300 Subject: [PATCH 1/3] Add missing .NET installation architecture info to error messages --- Source/Engine/Scripting/Runtime/DotNet.cpp | 52 +++++++++++-------- .../Flax.Build/Build/DotNet/DotNetSdk.cs | 2 +- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Source/Engine/Scripting/Runtime/DotNet.cpp b/Source/Engine/Scripting/Runtime/DotNet.cpp index f69e0c060..671b6b31b 100644 --- a/Source/Engine/Scripting/Runtime/DotNet.cpp +++ b/Source/Engine/Scripting/Runtime/DotNet.cpp @@ -1798,6 +1798,33 @@ bool InitHostfxr() get_hostfxr_params.dotnet_root = dotnetRoot.Get(); } #endif + String platformStr; + switch (PLATFORM_TYPE) + { + case PlatformType::Windows: + case PlatformType::UWP: + if (PLATFORM_ARCH == ArchitectureType::x64) + platformStr = "Windows x64"; + else if (PLATFORM_ARCH == ArchitectureType::ARM64) + platformStr = "Windows ARM64"; + else + platformStr = "Windows x86"; + break; + case PlatformType::Linux: + platformStr = PLATFORM_ARCH_ARM64 ? "Linux ARM64" : PLATFORM_ARCH_ARM ? "Linux Arm32" : PLATFORM_64BITS ? "Linux x64" : "Linux x86"; + break; + case PlatformType::Mac: + platformStr = PLATFORM_ARCH_ARM || PLATFORM_ARCH_ARM64 ? "macOS ARM64" : PLATFORM_64BITS ? "macOS x64" : "macOS x86"; + break; + default: + if (PLATFORM_ARCH == ArchitectureType::x64) + platformStr = "x64"; + else if (PLATFORM_ARCH == ArchitectureType::ARM64) + platformStr = "ARM64"; + else + platformStr = "x86"; + } + char_t hostfxrPath[1024]; size_t hostfxrPathSize = sizeof(hostfxrPath) / sizeof(char_t); int rc = get_hostfxr_path(hostfxrPath, &hostfxrPathSize, &get_hostfxr_params); @@ -1810,9 +1837,9 @@ bool InitHostfxr() Platform::OpenUrl(TEXT("https://dotnet.microsoft.com/en-us/download/dotnet")); #endif #if USE_EDITOR - LOG(Fatal, "Missing .NET 8 or later SDK installation required to run Flax Editor."); + LOG(Fatal, "Missing .NET 8 or later SDK installation for {0} is required to run Flax Editor.", platformStr); #else - LOG(Fatal, "Missing .NET 8 or later Runtime installation required to run this application."); + LOG(Fatal, "Missing .NET 8 or later Runtime installation for {0} is required to run this application.", platformStr); #endif return true; } @@ -1870,27 +1897,6 @@ bool InitHostfxr() hostfxr_close(handle); if (rc == 0x80008096) // FrameworkMissingFailure { - String platformStr; - switch (PLATFORM_TYPE) - { - case PlatformType::Windows: - case PlatformType::UWP: - if (PLATFORM_ARCH == ArchitectureType::x64) - platformStr = "Windows x64"; - else if (PLATFORM_ARCH == ArchitectureType::ARM64) - platformStr = "Windows ARM64"; - else - platformStr = "Windows x86"; - break; - case PlatformType::Linux: - platformStr = PLATFORM_ARCH_ARM64 ? "Linux ARM64" : PLATFORM_ARCH_ARM ? "Linux Arm32" : PLATFORM_64BITS ? "Linux x64" : "Linux x86"; - break; - case PlatformType::Mac: - platformStr = PLATFORM_ARCH_ARM || PLATFORM_ARCH_ARM64 ? "macOS ARM64" : PLATFORM_64BITS ? "macOS x64" : "macOS x86"; - break; - default:; - platformStr = ""; - } LOG(Fatal, "Failed to resolve compatible .NET runtime version in '{0}'. Make sure the correct platform version for runtime is installed ({1})", platformStr, String(init_params.dotnet_root)); } else diff --git a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs index bf3c61f7e..d12e4b8df 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs @@ -115,7 +115,7 @@ namespace Flax.Build /// Init with a proper message. /// public MissingException() - : base(string.IsNullOrEmpty(Configuration.Dotnet) ? $"Missing .NET SDK {MinimumVersion} (or higher)." : $"Missing .NET SDK {Configuration.Dotnet}.") + : base(string.IsNullOrEmpty(Configuration.Dotnet) ? $"Missing .NET SDK {MinimumVersion} (or higher) for {Platform.BuildTargetPlatform} {Platform.BuildTargetArchitecture}." : $"Missing .NET SDK {Configuration.Dotnet}.") { } } From 0d140c4f39da982c76e9ad6f0b711b33a853caee Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Fri, 24 Oct 2025 23:21:46 +0300 Subject: [PATCH 2/3] Fix Windows dotnet version lookup without installed SDK Having only x86 dotnet SDK installed while expecting x64 version fails prematurely. --- Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs index d12e4b8df..7e55377fd 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/DotNetSdk.cs @@ -218,8 +218,8 @@ namespace Flax.Build using RegistryKey runtimeKey = baseKey.OpenSubKey(@$"SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\{arch}\sharedfx\Microsoft.NETCore.App"); using RegistryKey hostKey = baseKey.OpenSubKey(@$"SOFTWARE\dotnet\Setup\InstalledVersions\{arch}\sharedhost"); dotnetPath = (string)hostKey.GetValue("Path"); - dotnetSdkVersions = sdkVersionsKey.GetValueNames(); - dotnetRuntimeVersions = runtimeKey.GetValueNames(); + dotnetSdkVersions = sdkVersionsKey?.GetValueNames() ?? Enumerable.Empty(); + dotnetRuntimeVersions = runtimeKey?.GetValueNames() ?? Enumerable.Empty(); } #pragma warning restore CA1416 break; From 280035e54f15a248c2c9e590b233638957cdce89 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Fri, 24 Oct 2025 23:23:39 +0300 Subject: [PATCH 3/3] Use stderr for Flax.Build error messages This turns the error messages from Flax.Build to red in Flax Editor console output. --- Source/Tools/Flax.Build/Log.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Tools/Flax.Build/Log.cs b/Source/Tools/Flax.Build/Log.cs index fbc96e576..834e51768 100644 --- a/Source/Tools/Flax.Build/Log.cs +++ b/Source/Tools/Flax.Build/Log.cs @@ -65,7 +65,10 @@ namespace Flax.Build if (ApplyConsoleColors) Console.ForegroundColor = color; - Console.WriteLine(Indent + message); + if (color != ConsoleColor.Red) + Console.WriteLine(Indent + message); + else + Console.Error.WriteLine(Indent + message); if (ApplyConsoleColors) Console.ResetColor();