diff --git a/scripts/guibuild.py b/scripts/guibuild.py index 198fce5..313c3ad 100755 --- a/scripts/guibuild.py +++ b/scripts/guibuild.py @@ -216,11 +216,22 @@ def fetch_vpk() -> Path: def _dotnet() -> str: - """Resolve the dotnet host, preferring DOTNET_ROOT (a plain `dotnet` may - resolve to a runtime-only installation without the SDK/runtime we need).""" + """Resolve the dotnet host with an SDK/modern runtime. + + A plain `dotnet` may resolve to a runtime-only installation (e.g. + C:\\Program Files\\dotnet), and long-running services (CI runners) may + carry a stale environment without DOTNET_ROOT or scoop paths — so probe + known locations explicitly. + """ + candidates = [] root = os.environ.get("DOTNET_ROOT") if root: - exe = Path(root) / ("dotnet.exe" if sys.platform == "win32" else "dotnet") + candidates.append(Path(root)) + if sys.platform == "win32": + candidates.append(Path(r"C:\ProgramData\scoop\apps\dotnet-sdk\current")) + exe_name = "dotnet.exe" if sys.platform == "win32" else "dotnet" + for base in candidates: + exe = base / exe_name if exe.exists(): return str(exe) return "dotnet"