diff --git a/csharp/codeql-extractor.yml b/csharp/codeql-extractor.yml
index 8cba8f18e47e..0a43f38800fd 100644
--- a/csharp/codeql-extractor.yml
+++ b/csharp/codeql-extractor.yml
@@ -7,6 +7,9 @@ column_kind: "utf16"
overlay_support_version: 20250626
extra_env_vars:
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
+ # The MSBuild server may have been started outside the traced build.
+ DOTNET_CLI_USE_MSBUILD_SERVER: "false"
+ MSBUILDDISABLENODEREUSE: "1"
build_modes:
- autobuild
- manual
diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_build/dotnet_build.csproj b/csharp/ql/integration-tests/all-platforms/dotnet_build/dotnet_build.csproj
index dfb40caafcf9..fa3911a265ec 100644
--- a/csharp/ql/integration-tests/all-platforms/dotnet_build/dotnet_build.csproj
+++ b/csharp/ql/integration-tests/all-platforms/dotnet_build/dotnet_build.csproj
@@ -7,4 +7,11 @@
enable
+
+
+
+
+
diff --git a/csharp/ql/integration-tests/all-platforms/dotnet_build/test.py b/csharp/ql/integration-tests/all-platforms/dotnet_build/test.py
index 75ba09477fa0..43d4885080dc 100644
--- a/csharp/ql/integration-tests/all-platforms/dotnet_build/test.py
+++ b/csharp/ql/integration-tests/all-platforms/dotnet_build/test.py
@@ -1,4 +1,5 @@
import os
+import pytest
def check_build_out(msg, s):
lines = s.splitlines()
@@ -6,8 +7,11 @@ def check_build_out(msg, s):
any (("[build-stdout]" in line) and (msg in line) for line in lines)
), f"The C# tracer did not interpret the dotnet path-to-application command correctly."
-def test1(codeql, csharp):
- codeql.database.create(command="dotnet build")
+@pytest.mark.parametrize("command", ["build", "msbuild -restore", "publish", "pack"])
+def test1(codeql, csharp, command):
+ codeql.database.create(
+ command=f"dotnet {command} -t:Build,CheckMSBuildServer",
+ )
# This test checks that we don't inject any flags when running the application using `dotnet`
diff --git a/csharp/ql/lib/change-notes/2026-11-26-msbuild-tracing.md b/csharp/ql/lib/change-notes/2026-11-26-msbuild-tracing.md
new file mode 100644
index 000000000000..9f86730773c8
--- /dev/null
+++ b/csharp/ql/lib/change-notes/2026-11-26-msbuild-tracing.md
@@ -0,0 +1,4 @@
+---
+category: fix
+---
+* Disabled MSBuild server and node reuse by default during C# traced builds to improve extraction reliability.