Probe scoop dotnet-sdk path explicitly (runner service has stale env)
release / gui-build (linux, bash) (push) Successful in 1m3s
release / gui-build (macos, bash) (push) Successful in 1m5s
release / gui-build (windows, cmd) (push) Successful in 1m34s

This commit is contained in:
2026-09-22 23:14:08 +00:00
parent 3377702e98
commit 59d2f157eb
+14 -3
View File
@@ -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"