diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 95ffa08ccba..2df8239b65e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -137,9 +137,18 @@ jobs:
-
-
+
+
+
+
+
+
+
+
+
+
+
EOF
diff --git a/smoketests/tests/csharp_module.py b/smoketests/tests/csharp_module.py
index 6eda4e2ce4f..6207994a46e 100644
--- a/smoketests/tests/csharp_module.py
+++ b/smoketests/tests/csharp_module.py
@@ -4,6 +4,7 @@
from pathlib import Path
import shutil
import subprocess
+import xml.etree.ElementTree as xml
@requires_dotnet
@@ -26,20 +27,28 @@ def test_build_csharp_module(self):
packed_projects = ["BSATN.Runtime", "Runtime"]
- config = []
- config.append("")
- config.append("")
- config.append("")
- config.append("")
+ config = xml.Element("configuration")
+
+ sources = xml.SubElement(config, "packageSources")
+ mappings = xml.SubElement(config, "packageSourceMapping")
+
for project in packed_projects:
+ # Add local build directories as NuGet repositories.
path = bindings / project / "bin" / "Release"
- config.append("\n" % (project, str(path)))
- config.append("")
- config.append("")
- config.append("")
- config.append("")
+ project = f"SpacetimeDB.{project}"
+ xml.SubElement(sources, "add", key=project, value=str(path))
+
+ # Add strict package source mappings to ensure that
+ # SpacetimeDB.* packages are used from those directories
+ # and never from nuget.org.
+ #
+ # This prevents bugs where we silently used an outdated
+ # version which led to tests passing when they shouldn't.
+ mapping = xml.SubElement(mappings, "packageSource", key=project)
+ xml.SubElement(mapping, "package", pattern=project)
- config = "\n".join(config)
+ xml.indent(config)
+ config = xml.tostring(config, encoding="unicode", xml_declaration=True)
print("Writing `nuget.config` contents:")
print(config)