Building for Linux on Windows: Failed to get .NET SDK location for the current host platform

I’m having trouble cooking a Linux build from my Windows machine using Flax 1.11. Windows builds work perfectly, but the Linux cooker fails during the SDK check phase. I do have the Linux build platform installed.

Log Output:

[ 00:07:50.123 ]: [Info] Starting Game Cooker...
[ 00:07:50.123 ]: [Info] Platform: Linux x64, Configuration: Release, Options: 1
[ 00:07:50.123 ]: [Info] Output Path: C:\Users/me/Documents/GitHub/my_game/Output/Linux
[ 00:07:50.124 ]: [Info] Starting scripts compilation for game...
[ 00:07:50.124 ]: [Info] Command: C:\Program Files (x86)/Flax/Flax_1.11/Binaries/Tools/Flax.Build.exe -log -logfile="C:\Users/me/Documents/GitHub/my_game/Cache/Cooker/Linux/CompileLog.txt" -build -mutex -buildtargets=GameTarget -platform=Linux -arch=x64 -configuration=Release -aotMode=None -dotnet=8 -BuildBindingsOnly -SkipTargets=FlaxGame
[ 00:07:50.196 ]: [Info] Flax.Build 1.0.0
[ 00:07:50.251 ]: [Info] Building targets...
[ 00:07:50.265 ]: [Info] Found Android SDK at C:\Users\me\AppData\Local\Android\Sdk
Found Android NDK 29.0.14206865 at C:\Users\me\AppData\Local\Android\Sdk\ndk\29.0.14206865
[ 00:07:50.285 ]: [Info] Building C# only
Building target GameTarget in Release for Linux x64
[ 00:07:50.290 ]: [Info] Building referenced target Flax
[ 00:07:51.741 ]: [Info] Using .NET SDK 8.0.418, runtime 8.0.24 (C:\Program Files\dotnet\)
[ 00:07:52.243 ]: [Info] Found 15 valid and 0 invalid actions in Task Graph cache
[ 00:07:52.244 ]: [Info] Done!
Total time: 00:00:02.0633018
[ 00:07:52.262 ]: [Info] Deploying binaries from build C:\Users/me/Documents/GitHub/my_game/Binaries/GameTarget/Linux/x64/Release/GameTarget.Build.json
[ 00:07:52.262 ]: [Info] Deploying binaries from build C:\Program Files (x86)/Flax/Flax_1.11/Source/Platforms/Linux/Binaries/Game/x64/Release/FlaxGame.Build.json
[ 00:07:52.263 ]: [Info] Collecting binary module FlaxEngine
[ 00:07:52.306 ]: [Info] Collecting binary module Game
[ 00:07:52.320 ]: [Info] Command: C:\Program Files (x86)/Flax/Flax_1.11/Binaries/Tools/Flax.Build.exe -log -logMessagesOnly -logFileWithConsole -logfile=SDKs.txt -printDotNetRuntime -platform=Linux -arch=x64 -dotnet=8
[ 00:07:52.320 ]: [Info] Working directory: C:\Users/me/Documents/GitHub/my_game/Cache/Cooker/Linux
[ 00:07:52.854 ]: [Error] Failed to get .NET SDK location for the current host platform.
[ 00:07:52.854 ]: [Error] Game building failed!

Environment:

  • OS: Windows 11
  • Flax Version: 1.11
  • .NET SDKs installed:
> dotnet --list-sdks
8.0.418 [C:\Program Files\dotnet\sdk]
10.0.103 [C:\Program Files\dotnet\sdk]
  • Linux Toolchain: I have the Linux build platform installed in the Flax directory.

What I’ve tried:

  • Verified that .NET 8 SDK is installed and in the system PATH.
  • Deleted the Cache and Binaries folders and retried.
  • Uninstalled .NET 10 and reinstalled 8 SDK (and a host of other Visual Studio build components).

Is there a specific environment variable or extra library I need for the Linux build to work on Windows?

I’m having the exact same issue, did you find any solution perhaps?

No solution found or answers given. I haven’t posted an issue on GitHub as I assume I am just overlooking something basic. I have found Flax struggles with dotnet environment, especially on Linux, as I’ve had issues building from Linux as well. It always gets confused about which runtime to use. It has something to do with the builder using the wrong version of dotnet or finding the wrong version. I have uninstalled version 10, reinstalled version 8, cleared and edited the cache file versions listed, all with no resolution. I think the way dotnet handles platform dependencies has changed and Flax is still just querying the Program Files for a platform or something like that.

I’m not done trying, but I only revisit it once in a while, as even the current Linux builds crash if you use .ogg audio resources, which I do. I think that will be fixed in the 1.12 release.

We don’t support cross-build from Windows to Linux. It used to work a bit but at time when we had mono for C# runtime instead of modern .NET nethost runtime. It’s still probably doable but proper .NET SDK integration needs to be implemented for this. Otherwise you could disable C# (set UseCSharp: false in Flax.flaxproj).

1 Like