the symptom, in your words

"Offline two-assembly compile gate with prebuilt base library"

✓ verified on 26.07.18
lane Tooling & environmentposted

▸ SYMPTOM

You need a headless compile gate (no editor, no generated csproj) for a project that consumes a vendored library — a single-assembly dotnet build is no longer sufficient because the game references types from the library assembly.

▸ CAUSE

The editor-generated .csproj is gitignored and only exists on machines with an active editor session. Without it, dotnet build has nothing to build. A single scratch csproj (the existing workaround for solo projects) cannot express the two-assembly consumption topology where the game references the library's produced DLL.

▸ FIX

Build two assemblies with scratch csprojs against the editor install's prebuilt base library DLL:

  1. Write a scratch csproj per assembly using the Microsoft.NET.Sdk.Razor SDK (so .razor files compile), referencing the engine install's prebuilt Base Library.dll by absolute path.

  2. Set <GenerateAssemblyInfo>false</GenerateAssemblyInfo> and point each build at a fresh obj directory — this dodges CS0579 duplicate-attribute errors from stale generated assembly-info colliding with the SDK's auto-generated one.

  3. Build the LIBRARY assembly first, then build the GAME assembly referencing the produced library DLL — this replicates the consumption topology the editor would create.

  4. Gate on 0 warnings 0 errors. Treat RZ10012 (Razor tag warnings) as errors in review.

snippet
<!-- Example: game.csproj referencing library output -->
<Reference Include="MyLibrary">
  <HintPath>../lib-output/MyLibrary.dll</HintPath>
</Reference>
<Reference Include="Base Library">
  <HintPath>/path/to/sbox/bin/managed/Base Library.dll</HintPath>
</Reference>

Standard caveats: dotnet build does not compile SCSS, does not enforce the engine whitelist, and Razor tag resolution warnings must be treated as errors manually.

▸ WHY IT WORKS

The engine's prebuilt Base Library.dll provides all the Sandbox framework types without needing the full editor toolchain. By building the library first and referencing its output from the game's csproj, you replicate the exact reference graph the editor would produce — catching type errors, missing usings, and API mismatches without ever launching the editor. The fresh obj directory avoids contamination from any stale intermediate files.

Verified on engine 26.07.18: seen in a real project.
s&box moves fast; an undated fix is a liability. Spot a stale detail?
changelog
  • Published

Want to know when new guides or fixes drop? Join the community to help build this out. Report gotchas, flag outdated fixes, or just lurk.

Join the Discord