Repository navigation
Closed
Labels
Description
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-14templates/csharp/MyResource.csproj:1-15templates/csharp/Server/ServerMain.cs:8-11
Details
- Scaffolded
Server/ServerMain.cshas onlyusing System; using CitizenFX.Core;but callsGetCurrentResourceName()(line 252). That is a static onCitizenFX.Core.Native.API; the client file imports it withusing static CitizenFX.Core.Native.API;(line 224), the server file does not. Result: CS0103. - The scaffolded csproj has
<Reference Include="CitizenFX.Core">with noHintPath(the template has one atMyResource.csproj:10), so the reference does not resolve. - The scaffold builds one project covering
Client/andServer/, which outputs{name}.dll, but its manifest lists'Client/ClientMain.net.dll'and'Server/ServerMain.net.dll'. generate_manifestlists'{name}.net.dll'for both sides; the template lists'MyResource.net.dll'. No csproj sets<AssemblyName>, so no*.net.dllis ever produced.templates/csharp/Server/ServerMain.cs:8registersnew 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
scaffold_resource_tool(name="x", game="gta5", language="csharp", framework="standalone").dotnet build x/x.csprojfails (unresolved reference or CS0103 inServer/ServerMain.cs).- Compare the script entries from
generate_manifest_tool(name="x", language="csharp", ...), the scaffoldedfxmanifest.lua, andtemplates/csharp/fxmanifest.lua. - 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 (
AssemblyNameX.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, andskills/resource-scaffolding/SKILL.mdagree. - 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/csharpbuilds, and its manifest matches its build output. -
generate_manifest_toolandscaffold_resource_toolemit 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
TMHSDigital commentedon Nov 21, 2026
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 buildof 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.