Skip to content

C# scaffold fails to compile; C# manifests reference DLLs that are never built #28

Closed

Description

@TMHSDigital

Summary

The C# resource produced by scaffold_resource_tool does not compile, and the C# manifests from the scaffold, from generate_manifest_tool, and from templates/csharp all reference different *.net.dll files that no csproj in the repo produces. The C# template's server script also does not compile.

Where

  • mcp-server/tools/scaffold.py:239-256 (_scaffold_csharp, server_cs)
  • mcp-server/tools/scaffold.py:206-219 (_scaffold_csharp, csproj)
  • mcp-server/tools/scaffold.py:128-135 (_build_manifest, C# branch)
  • mcp-server/tools/manifest_gen.py:97-99 (generate_manifest, C# branch)
  • templates/csharp/fxmanifest.lua:8-14
  • templates/csharp/MyResource.csproj:1-15
  • templates/csharp/Server/ServerMain.cs:8-11

Details

  1. Scaffolded Server/ServerMain.cs has only using System; using CitizenFX.Core; but calls GetCurrentResourceName() (line 252). That is a static on CitizenFX.Core.Native.API; the client file imports it with using static CitizenFX.Core.Native.API; (line 224), the server file does not. Result: CS0103.
  2. The scaffolded csproj has <Reference Include="CitizenFX.Core"> with no HintPath (the template has one at MyResource.csproj:10), so the reference does not resolve.
  3. The scaffold builds one project covering Client/ and Server/, which outputs {name}.dll, but its manifest lists 'Client/ClientMain.net.dll' and 'Server/ServerMain.net.dll'.
  4. generate_manifest lists '{name}.net.dll' for both sides; the template lists 'MyResource.net.dll'. No csproj sets <AssemblyName>, so no *.net.dll is ever produced.
  5. templates/csharp/Server/ServerMain.cs:8 registers new Action<dynamic>(OnServerEvent) for a method with two parameters, ([FromSource] Player player, dynamic data), which does not match the delegate and fails to compile.

Impact

Every language="csharp" scaffold fails dotnet build, and even a hand-fixed build does not produce the files the manifest lists, so FXServer reports missing scripts. The same is true for the template and for generate_manifest_tool output. Two manifest builders described as sharing code have already drifted.

Steps to reproduce

  1. scaffold_resource_tool(name="x", game="gta5", language="csharp", framework="standalone").
  2. dotnet build x/x.csproj fails (unresolved reference or CS0103 in Server/ServerMain.cs).
  3. Compare the script entries from generate_manifest_tool(name="x", language="csharp", ...), the scaffolded fxmanifest.lua, and templates/csharp/fxmanifest.lua.
  4. Build templates/csharp: the server file fails on the delegate mismatch.

Suggested fix

  • Add using static CitizenFX.Core.Native.API; to the scaffolded server file.
  • Fix the template server handler signature (for example new Action<Player, dynamic>(OnServerEvent) with matching parameters).
  • Pick one layout and use it everywhere: either separate Client and Server projects (AssemblyName X.Client.net / X.Server.net, each referencing the matching CitizenFX.Core package), or a single project with <AssemblyName>$(MSBuildProjectName).net</AssemblyName>. Make the scaffold, generate_manifest, the template, and skills/resource-scaffolding/SKILL.md agree.
  • Give the scaffolded csproj a working reference (HintPath or package reference) like the template.

Acceptance criteria

  • A scaffolded C# resource builds with dotnet build (given the CitizenFX.Core reference) and the manifest lists exactly the produced DLL paths.
  • templates/csharp builds, and its manifest matches its build output.
  • generate_manifest_tool and scaffold_resource_tool emit the same C# script entries for the same inputs (parity test).
  • The resource-scaffolding skill documents the chosen layout.

Getting started

  • Relevant files: mcp-server/tools/scaffold.py, mcp-server/tools/manifest_gen.py, templates/csharp/, skills/resource-scaffolding/SKILL.md
  • How to run checks: there is no test suite yet; run the MCP server with cd mcp-server && pip install -r requirements.txt && python server.py, and CI checks live in .github/workflows/validate.yml
  • Related docs: rules/cfx-csharp-conventions.mdc, FiveM C# scripting docs on docs.fivem.net

Filed by repo-audit/full-audit at 701824d. Severity: high. Effort: M. audit-key: bug|mcp-server/tools/scaffold.py|_scaffold_csharp

Activity

  1. added
    bug
    on Nov 21, 2026
  2. TMHSDigital commented on Nov 21, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in 9ed46d1.

    Adopted one C# layout everywhere: Client/.Client.csproj and Server/.Server.csproj (CitizenFX.Core.Client/.Server packages) building dist/..net.dll. Scaffold, generate_manifest and the template share it; fixed the server import and the template delegate; documented it in the skills.

    Verified: dotnet build of templates/csharp and of a freshly scaffolded resource: 0 errors, and the DLLs land at the paths the manifests list. scaffold and generate_manifest emit identical C# script entries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugseverity: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions