From b8aeaf74dc4932fa726771f68a3e13926a6c0514 Mon Sep 17 00:00:00 2001 From: zinefer Date: Sun, 8 Feb 2026 16:10:35 -0700 Subject: [PATCH] Bugfix: Replace // with \\ before sending project path to MSBuild On Windows with network shares, the project path starts with "//" which MSBuild treats as a command-line switch, causing "Unknown switch" errors. Replace the first two chars with "\\" to make it a proper UNC path. --- .../GodotTools/Build/BuildSystem.cs | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs index 3428962a81..db582510a3 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs @@ -154,7 +154,17 @@ namespace GodotTools.Build arguments.Add(buildInfo.OnlyClean ? "clean" : "build"); // C# Project - arguments.Add(buildInfo.Project); + string projectPath = buildInfo.Project; + if (OperatingSystem.IsWindows()) + { + // On Windows, when using a network share path, the path may start with "//" + // which MSBuild will treat like a switch. Convert to "\\" to make it an absolute path. + if (projectPath.StartsWith("//")) + { + projectPath = "\\\\" + projectPath.Substring(2); + } + } + arguments.Add(projectPath); // `dotnet clean` doesn't recognize these options if (!buildInfo.OnlyClean) @@ -195,7 +205,17 @@ namespace GodotTools.Build arguments.Add("publish"); // `dotnet publish` command // C# Project - arguments.Add(buildInfo.Project); + string projectPath = buildInfo.Project; + if (OperatingSystem.IsWindows()) + { + // On Windows, when using a network share path, the path may start with "//" + // which MSBuild will treat like a switch. Convert to "\\" to make it an absolute path. + if (projectPath.StartsWith("//")) + { + projectPath = "\\\\" + projectPath.Substring(2); + } + } + arguments.Add(projectPath); // Restore // `dotnet publish` restores by default, unless requested not to