"Offline two-assembly compile gate with prebuilt base library"
▸ 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:
-
Write a scratch csproj per assembly using the
Microsoft.NET.Sdk.RazorSDK (so.razorfiles compile), referencing the engine install's prebuiltBase Library.dllby absolute path. -
Set
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>and point each build at a freshobjdirectory — this dodgesCS0579duplicate-attribute errors from stale generated assembly-info colliding with the SDK's auto-generated one. -
Build the LIBRARY assembly first, then build the GAME assembly referencing the produced library DLL — this replicates the consumption topology the editor would create.
-
Gate on 0 warnings 0 errors. Treat
RZ10012(Razor tag warnings) as errors in review.
<!-- 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.
- Published