Two custom tools run during the build to produce the master data ("master asset") files that DragaliaAPI loads at runtime. Both run at the start of the build, before the .NET SDK's content-copy pipeline, so their outputs are handled by standard build machinery from then on.
DragaliaAPI.MissionDesigner (runs as part of its own Build)
[ContainsMissionList] C# DSL ──► DragaliaAPI.Shared/Resources/Missions/MissionProgressionInfo.json
(written into the source tree, checked into git)
│
▼
DragaliaAPI.Shared/Resources/**/*.json (all master data, including the file above)
│
▼
DragaliaAPI.MasterAssetConverter (runs early in DragaliaAPI's build, BeforeTargets=AssignTargetPaths)
JSON ──► obj/<cfg>/<tfm>/masterassets/**/*.msgpack
│
registered as Content items with CopyToOutputDirectory=PreserveNewest
│
┌───────────────────────────────────────┼──────────────────────────────────┐
▼ ▼ ▼
DragaliaAPI/bin/.../Resources/ test project bin/.../Resources/ publish/Resources/
(own output) (flows transitively to anything (`dotnet publish`,
referencing DragaliaAPI.csproj — used by Docker)
no opt-in property needed)
DragaliaAPI.csprojhasProjectReferences (withReferenceOutputAssembly="false") to both tool projects, so MSBuild builds them — and, for MissionDesigner, runs it — before DragaliaAPI's own targets execute.- Inside DragaliaAPI's build, conversion is hooked
BeforeTargets="AssignTargetPaths": afterResolveProjectReferences(tools exist), before the content pipeline (outputs get picked up).
- MasterAssetConverter (
MasterAssetConverter.targets): declares each.jsonas an input and the correspondingobj/.../masterassets/*.msgpackas an output. On a warm build the target is skipped; when some JSON files change, MSBuild passes only those files to the tool (partial incremental build). - MissionDesigner (
MissionDesigner.targets): inputs are the freshly built designer assembly (a proxy for the C# mission DSL) andMissionNormalData.json; output isMissionProgressionInfo.json. The tool only reruns when the DSL or that file changed.
- Test projects get
Resources/**/*.msgpackin their output directory simply by referencingDragaliaAPI.csproj(transitive content copy). The oldDependsOnApiMsgpackFilesopt-in property and manual copy target are gone. dotnet publishincludes the files automatically.Cleanremoves the generated files from bothobj/andbin/(viaFileWrites), but never touchesMissionProgressionInfo.json— that is a checked-in source file.
MasterAssetConverter <outputDir> <resourcesPath> <jsonFile1> [<jsonFile2> ...]
For each JSON file it finds the matching [GenerateMasterAsset<T>] (or [ExtendMasterAsset])
attribute on the MasterAsset class in DragaliaAPI.Shared, deserializes the JSON, and writes a
MessagePack binary to <outputDir>/<relative-path>.msgpack.