Game export — File › Export, presets, mf-export
Milestone: Shipping games (G5) · Status: ✅ shipped · Decisions: ADR 0229 (runner, library, format 5, spike outcomes), ADR 0230 (the open questions) · Related: Release → Games, Editor → Export, Project and GameHost, Steamworks, Crash reporting → Symbols, Distribution via NuGet, Mobile core (M12.7 extends the presets)
Player builds come from export presets stored in project.mfproj (export). One C# pipeline,
ExportRunner in Tools/MainframeEngine.Export, runs them for every entry
point, so they all produce the same output:
flowchart LR
D["Editor: File › Export…<br/>ExportDialog + ExportService"] --> R
C["mf-export CLI<br/>just export · just package-game · CI"] --> R
E["Editor --export-release / --export-debug / --export-all<br/>(no window, SDL or engine)"] --> R
R["ExportRunner<br/>(Tools/MainframeEngine.Export)"] --> V["validate"] --> P["dotnet publish -r RID<br/>--artifacts-path · -p:MainframeDemo"]
P --> S["stage: rename apphost · prune natives<br/>filter Assets · asset index · project.mfproj · symbols"]
S --> B["macOS: .app + Info.plist + .icns · codesign · notarize"]
B --> A["archive: .zip / .tar.gz / folder"]
build/package-game.sh is gone; just package-game keeps its arguments and runs mf-export. The editor, which drives
the first and third entry points, lives in mainframe-editor.
Preset schema (project.mfproj → export)
Section titled “Preset schema (project.mfproj → export)”export is an array of presets. Keys common to every platform sit next to platform-specific ones, flat. Defaults are not
written, like every other section.
"export": [ { "name": "Windows (Steam)", "platform": "windows", "rid": "win-x64", "output": "export/windows", "steam": true }, { "name": "Windows (Steam demo)", "platform": "windows", "rid": "win-x64", "output": "export/windows-demo", "demo": true, "steam": true }, { "name": "macOS", "platform": "macos", "rid": "osx-arm64", "output": "export/macos", "bundleId": "com.example.mygame", "copyright": "© 2026 Example", "sign": "Developer ID Application: Example (ABCDE12345)", "notaryProfile": "example-notary" }, { "name": "Linux", "platform": "linux", "rid": "linux-x64", "output": "export/linux" }, { "name": "Linux server (headless)", "platform": "linux", "rid": "linux-x64", "output": "export/server", "archive": false, "exclude": ["Assets/Audio/**"], "profiler": false }]| Key | Platforms | Default | Meaning |
|---|---|---|---|
name | all | required, unique | Shown in the dialog; mf-export --preset selects presets by it. |
platform | all | required | windows, macos, linux (M12.7 adds android, ios). Selects the known keys. |
rid | desktop | the platform’s first supported RID | win-x64, linux-x64, osx-arm64, osx-x64: the RIDs with engine natives under MainframeEngine/runtimes/. |
output | all | export/<name as a slug> | Output folder, project-relative or absolute. Not inside Assets/. |
configuration | all | Release | Debug exports are development runs (see Steam). |
demo | all | false | -p:MainframeDemo=true|false: one project ships the full game and its demo. The top-level isDemo stays the editor and Play setting. |
steam | desktop | false | Off: the exported project.mfproj gets app ids 0 (Steam stays inert). On: validated, see Steam. |
version | all | "" = project version, else 0.0.0 | Names the archive and fills CFBundleShortVersionString. Mobile maps it to versionName. |
icon | all | "" = window.icon | A PNG; becomes .ico (Windows) and .icns (macOS). An explicit preset icon also wins over the desktop project’s own ApplicationIcon/MacAppIcon. |
exe | desktop | the project name without spaces | The player-facing executable. |
selfContained | desktop | true | false makes players install .NET 11 (servers that have it). |
readyToRun | desktop | true | -p:PublishReadyToRun: faster start-up, larger output. |
singleFile | desktop | false | -p:PublishSingleFile + IncludeNativeLibrariesForSelfExtract; Assets.mfpak (or, with pack: false, Assets/ and project.mfproj) stays beside the exe. Windows and Linux only. |
trim | desktop | false | -p:PublishTrimmed for a JIT build. The engine is trim-clean (G19 phase 4); still a warning, since a game’s own reflection may break. |
nativeAot | desktop | false | One native executable (NativeAOT): -p:MainframeNativeAot=true, no managed game or engine assembly ships. Overrides readyToRun, singleFile, trim and selfContained; needs a host of the target’s OS. |
symbols | desktop | ship | separate moves the PDBs, with their assemblies, into <exe>-<version>-<rid>-symbols.zip for mf-symbolicate (Crash reporting → Symbols); with nativeAot, the executable’s .dSYM, .dbg or .pdb. |
profiler | desktop | true | false publishes with MainframeProfilerDisabled=true: MainframeGame.props sets the MainframeEngine.Profiler.Disabled AppContext switch in the runtimeconfig (Profiler). |
archive | all | true | Zip (Windows, macOS) or .tar.gz (Linux). false leaves a folder (e.g. a Steam depot’s content root). |
include | all | ["Assets/**"] | Globs of the game’s Assets/ files that ship. |
exclude | all | ["Assets/**/*.po", "Assets/**/*.pot"] | Applied after include. .mo catalogs are compiled at build time. |
pack | all | true | Ship the staged Assets/ and project.mfproj in one Assets.mfpak beside the executable (Packed content). false ships them as loose files. |
encrypt | all | true | AES-256-CTR encrypt the pack with the project’s packKey (or MF_PACK_KEY), compiled into the game. Ignored when pack is false. |
loose | all | [] | Globs of shipped Assets/ files kept as loose files beside the pack (mods, files another tool reads). The game still reads them at the same paths. |
bundleId | macos | com.mainframegames.<exe lowercased> | CFBundleIdentifier. |
copyright | macos | "" | NSHumanReadableCopyright. |
sign | macos | "" = ad hoc | A Developer ID identity name (not a secret). MF_SIGN_IDENTITY overrides it. |
notaryProfile | macos | "" = no notarization | A notarytool keychain profile name. MF_NOTARY_PROFILE overrides it. |
Globs (Glob, in the export library: no globbing package) are * (within one folder), ** (any depth, also none) and
?, matched case-sensitively on project-relative paths with /. Only the game’s own files are filtered: a staged
Assets/ file that does not exist in the project’s Assets/ (engine shaders and UI, compiled .mo catalogs) always
ships, so a narrow include cannot break the engine. The editor-only folder never ships: Assets/Video (video
mode’s recordings, media and timelines, ADR 0241; ContentPaths.IsEditorOnly) is left out whatever the globs say, and
builds never copy it to the output in the first place (build/MainframeGame.props).
The C# model is ExportPreset (common keys) with
IExportPlatformOptions Options: DesktopExportOptions (with MacOsExportOptions? MacOs) now, mobile options in M12.7.
ProjectSettings.ExportPresets holds them; the reader checks known keys per platform (an Android key on a Windows
preset warns like any unknown key), duplicate names and bad values throw InvalidDataException with the key path. The
reader and writer are hand-written Utf8JsonWriter/JsonObject code in ProjectSettingsFormat, AOT-safe.
Format 5 (and 6)
Section titled “Format 5 (and 6)”Format 6 (G19 phase 3) adds the top-level packKey (Packed content); the step 5 → 6 generates it.
Before that, ProjectSettingsFormat.Current was 5. The step 4 → 5 does not change the tree: the bump only makes an older editor
reject the file (“Update the engine.”) instead of reading it, dropping the section it does not model, and deleting every
preset on its next save. The template’s project.mfproj is format 5 with no presets (the dialog adds one for this
machine), and its .gitignore has export/ and .mainframe/. The Demo has Windows, macOS, Linux and Linux server
presets. MainframeGame.props’ regex reads of window.icon and the top-level version stop at "export", whose
presets have icons and versions of their own.
The export library and ExportRunner
Section titled “The export library and ExportRunner”Tools/MainframeEngine.Export (namespace MainframeEngine.Export, references the
engine) holds the pipeline, plus the tool helpers the editor already used, moved out of it unchanged except for
namespaces: ProcessRunner, DotnetSdk, GameProjectLayout, MsBuildOutputParser/BuildDiagnostic. The editor
references the library (a global using). ThumbnailCache.Downscale moved to the engine as
ImageResize.Downscale. The thin
Tools/MainframeEngine.Export.Cli is mf-export.
| Type | Role |
|---|---|
ExportRequest(ProjectDirectory, Preset, OutputOverride?, AppName?) | one export (the preset need not be saved: the CLI’s legacy form makes one) |
ExportPhase, ExportProgress(PresetIndex, PresetCount, Phase, Fraction?, Status) | progress (Stage and Archive report fractions) |
ExportIssue(Severity, Code, Message, Fix?) | a validation finding |
ExportResult(Preset, Succeeded, Cancelled, ArtifactPath?, SymbolsPath?, Duration, Issues, Diagnostics, Error?) | Invalid, Summary, Tally(results) (3 exported, 1 failed, 1 skipped (invalid)) |
ExportEnvironment | the dotnet path and SDK check, host OS/RID, environment variables, the tool runner (codesign, xcrun, ditto, dotnet); DetectAsync() |
ExportRunner : IExportRunner | Validate, RunAsync, RunAllAsync (a failed or invalid preset does not stop the rest); never throws for export failures |
ExportPlan | pure: effective values, folders and the dotnet publish arguments |
ExportValidator, ContentFilter/Glob, NativesPruner, ExportedProjectFile, ReferenceScanner, IconWriter, AppBundleWriter, MacSigner, Archiver, SymbolCollector | the steps |
ExportCli | the command line of mf-export and of the editor’s export flags |
The steps of one preset:
- Validate. Errors stop this preset (in
RunAllAsync: it is skipped). - Icon (Windows).
IconWriterwrites an.icowith PNG entries (16–256 px, valid since Vista) before the publish and passes it asApplicationIcon, unless the desktop project sets its own. - Publish.
dotnet publish <Desktop.csproj> -c <cfg> -r <rid> --self-contained <bool> -p:MainframeDemo=<bool> -p:PublishReadyToRun=… -p:PublishSingleFile=… -p:PublishTrimmed=… [-p:IncludeNativeLibrariesForSelfExtract=true] [-p:MainframeProfilerDisabled=true] [-p:MainframeWindowsGui=true | -p:MacBundleAppDirectory=MonoBundle] [-p:ApplicationIcon=<ico>] --artifacts-path <project>/.mainframe/export/obj/<rid>-<full|demo> -o <stage>/publish -nologo -v:minimal -clp:NoSummary -p:GenerateFullPaths=truethrough the tool runner; lines stream toonLine, diagnostics are parsed withMsBuildOutputParser.ParseAll.--artifacts-pathmoves the bin/ and obj/ of the desktop project, the game library and the engine projects, so the full and demo defines, other RIDs and Release never rebuild or race the editor’s Debug output. The engine finds its Steamworks shim builds under the artifacts path too (MainframeEngine.csproj). The stage is<project>/.mainframe/export/stage/<preset slug>, emptied first. - Stage.
- Rename the apphost to
exe(.exeon Windows; mode 755 elsewhere). NativesPrunerdeletes every engine native of the other platforms and the othersteamworks/{win64,posix}folder. The list isMainframeEngine/runtimes/*/native/*, baked into the library at build time (EngineNatives.g.cs), so the package’s and the released editor’s exporter know it and new natives are pruned.- With
steam: true, the RID’ssteam_apinative andsteamworks/<variant>/MainframeEngine.Steamworks.dllmust be there (else the export fails:Steam.TryInitializewould reportNativeLibraryMissing). ContentFilterappliesinclude/excludeto the game’s files.- The exported
project.mfproj(below) is written over the published one. Assets/assets.index.json:new AssetDatabase(stage).Scan()+WriteIndex(), so shipped builds skip the start-up scan.- Fail if a
steam_appid.txtis in the stage. pack: true(default):PackWriterwritesAssets.mfpakfrom the stagedAssets/andproject.mfprojminus thelooseglobs, then deletes what it packed (Packed content).symbols: separate:SymbolCollector(the C# twin ofbuild/collect-symbols.sh) moves the PDBs, with copies of their assemblies, into<exe>-<version>-<rid>-symbols.zip.
- Rename the apphost to
- Bundle (macOS).
AppBundleWriterlays out<Name>.appas the macOS bundle layout requires: the apphost alone inContents/MacOS(checked to start../MonoBundle/<assembly>.dll), the rest inContents/MonoBundle,icon.icnsinContents/Resources(the desktop project’sMacAppIcon.icns, elseIconWriter’s PNG chunksicp4…ic10, 16 to 1024 px, never enlarged), and an XML Info.plist with the keys the old script wrote (name, bundle id, executable, icon, version, copyright,LSMinimumSystemVersion11.0,NSHighResolutionCapable, games category). - Sign / Notarize (macOS host).
MacSignerdoes whatbuild/macos/sign-app.shdoes (the editor’s own release still uses the script): every Mach-O (by its magic number) but the main executable, deepest first, then the bundle; never--deep; ad hoc by default; a Developer ID adds the hardened runtime, a timestamp and the .NET entitlements on the bundle; thencodesign --verify --deep --strict. WithnotaryProfile:dittozip,xcrun notarytool submit --wait,stapler staple, re-zip. - Archive.
<output>/<exe>-<version>-<rid>.zip(Windows:ZipArchive; macOS:ditto -c -k --norsrc --noextattr --keepParent) or.tar.gz(TarWriter+GZipStream) with explicit Unix modes (the executable andcreatedump755), so the executable bit survives an export from Windows. Archives are written as<name>.partialand moved over the old one at the end; a cancelled or failed export leaves the previous artifact intact.archive: falsemoves the publish (or the folder holding the.app) to<output>/<exe>-<version>-<rid>/the same way. - Clean. The stage, the
.icoand any.partialare deleted; the artifacts cache is kept for incremental exports.
Cancel cancels the token: the tool runner kills dotnet (or codesign/notarytool) with its process tree, the
stage and .partial files are deleted, and the result has Cancelled = true.
Packed content
Section titled “Packed content”G19 phase 2 (Protected exports, ADR 0239).
With pack: true an export folder holds the executable, the runtime and natives, Assets.mfpak and the loose files,
and no Assets/ folder or project.mfproj. The pack holds the game’s and the engine’s content (shaders, widgets,
fonts, .mo catalogs, the asset index) and the exported project file, at the paths they had in the stage.
- Only the stage is packed.
PackWriter.GameFiles(stage, …)reads the stage, never the project’sAssets/, so the editor-onlyAssets/Videofolder (which the build never copies) cannot ship, andinclude/excludehave already run. - At run time
GameHost.RuncallsGameHost.MountExportPack()before it readsproject.mfproj: the pack is mounted withContentFilesatContentPaths.BaseDirectory(Contents/MonoBundlein a macOS bundle), so every content read comes from it and loose files are the disk fallthrough. A damaged pack is a failed start (exit code 1, logged). Builds without a pack (the editor, Play,dotnet run) read loose files as before. - Encryption (phase 3,
encrypt: trueby default). The pack’s entries and index are AES-256-CTR encrypted with the project’spackKey(MF_PACK_KEYoverrides it, likeMF_SIGN_IDENTITY), so no file name or content is readable. The publish passes-p:MainframePackKey=<key>(printed as***);MainframeGame.propsmakes it aCompilerVisibleProperty, andMainframeEngine.Generatorsemits a[ModuleInitializer]in each game assembly that registers it withPackKeys, masked with SHA-256 of the assembly name, so neither its bytes nor its base64 are in any shipped file. The engine never gets it (only game projects import the props).GameHost.Runruns the game assemblies’ module initializers before it mounts the pack. A missing key isPackKeyMissingand a wrong onePackKeyMismatch, both at mount, before any read, and a failed start. In a JIT build the key can be recovered from the IL; withnativeAotit is machine code. Either way this stops “read the folder”, not a reverser. - Format and layout are in Asset pipeline → Packs: Brotli for text and data, stored and seekable media, and a layout that keeps SteamPipe patches small (ADR 0247).
- Looking inside.
mf-export --pack-list <Assets.mfpak> [--project <dir>]lists the entries (codec, length, path), andmf-export --pack-extract <Assets.mfpak> <dir> [--project <dir>]writes them out; an encrypted pack needs the project (itspackKey) orMF_PACK_KEY.
NativeAOT
Section titled “NativeAOT”G19 phase 4 (Protected exports, ADR 0259).
"nativeAot": true publishes the game as one native executable, so neither its code nor the pack key can be read back
as IL (ILSpy, an agent pointed at the folder). The engine is trim- and AOT-clean (its analyzers are errors), so a game
needs nothing new; its own reflection shows up as analyzer errors in the export.
- The publish is
--self-contained true -p:MainframeNativeAot=true(no ReadyToRun, single-file or trim properties).MainframeGame.propsturns the property intoPublishAotfor the game’s projects only, compiles the target OS’s Steamworks shim and Facepunch assembly into the executable (withbuild/steamworks/Facepunch.Steamworks.<build>.rd.xmlfor Facepunch’s callback structs), and publishes nosteamworks/folder, managed PDBs or XML docs. ILC warnings about known third-party code (Silk.NET, DependencyModel, Facepunch) stay warnings. - The stage fails when the publish still has a managed assembly (a desktop project that does not import
MainframeGame.props). The folder holds the executable, the engine’s natives,steam_apiwith Steam on,Assets.mfpakand anyloosefiles. - macOS: the executable alone is in
Contents/MacOS, the rest inContents/MonoBundleas for JIT builds;NativeAppBundlemakesMonoBundlethe process’s base directory at start-up. Signing and notarization are unchanged. - Hosts: NativeAOT compiles only for the OS it runs on (
native-aot-host): a Windows target needs Windows with the Visual Studio C++ tools, Linux needsclangandzlib1g-dev, macOS Xcode’s command line tools. CI builds each OS on its own runner. - Symbols and crashes:
symbols: separateputs the.dSYM/.dbg/.pdbin the symbols zip. NativeAOT crash frames carry the image’s build id and offset, andmf-symbolicateresolves them withllvm-symbolizer,atosoraddr2line(Crash reporting → Symbols, ADR 0260). - Testing:
just template-smoke-aot(this machine) andjust template-smoke-aot-linux(Docker) export the template game withnativeAotand separate symbols, check there is no managed file, PDB or XML doc, that the symbols zip holds the native symbols, and run it headless. CI’snative-aotjob runs the same on each OS runner (Linux, Windows, macOS) withHEADLESS_ONLY=1(no windowed run: the runners have no Vulkan device).
Exported project file
Section titled “Exported project file”ExportedProjectFile.Transform writes a changed copy of the project’s settings (never the file as is):
ExportPresets cleared; PackKey cleared; IsDemo = the preset’s demo; Version = the effective version; steam: false →
Steam.AppId = Steam.DemoAppId = 0 and RestartThroughSteam = false.
App ids stay in the steam section. The preset only has steam: true|false (ProjectSettings.SteamAppId already picks
demoAppId or appId by the built demo flag). The dialog shows the effective id read-only with an icon button to
Project Settings › Steamworks. For steam: true:
| Check | Severity | Why |
|---|---|---|
effective app id (full or demo) ≠ 0 (steam-app-id) | error | an id of 0 leaves Steam off |
the RID’s steam_api native and steamworks/<win64|posix>/ in the stage (with nativeAot, steam_api only: the shim is compiled in) | export error | only a broken publish lacks them |
configuration is Release (steam-debug) | warning | a Debug build is a development run: it writes steam_appid.txt on players’ machines and never relaunches through Steam |
Hosts and platforms
Section titled “Hosts and platforms”| Target | From macOS | From Windows | From Linux |
|---|---|---|---|
win-x64 | ✅ (exe icon and GUI subsystem too) | ✅ | ✅ |
linux-x64 | ✅ | ✅ (modes set in the tar) | ✅ |
osx-arm64, osx-x64 | ✅ ad hoc, Developer ID, notarization | ❌ host-unsupported | ❌ host-unsupported |
Self-contained cross-publishing works from any host; on .NET 10 the SDK also writes the Win32 icon resource into the
apphost from macOS and Linux (the spike found no NETSDK1074), and ReadyToRun cross-compiles win-x64 and linux-x64
from macOS. Other RIDs appear when MainframeEngine/runtimes/<rid>/native exists.
Validation
Section titled “Validation”ExportValidator.Validate starts no process (the SDK check comes from the environment, detected once per session).
The dialog re-runs it on every edit; the CLI before each preset.
| Code | Severity | Condition |
|---|---|---|
sdk-missing | error | no .NET SDK ≥ 10 (the message ends with the download URL) |
no-desktop-project | error | GameProjectLayout.DesktopProjectOf is null |
main-scene | error | mainScene empty or not resolvable (UID through the project’s AssetDatabase, or an Assets/ path) |
main-scene-excluded | error | the main scene, an enabled autoload scene or the bus layout is filtered out |
rid-unsupported | error | no engine natives for the RID, or a RID of another platform |
host-unsupported | error | a macOS target from a non-macOS host |
native-aot-host | error | nativeAot for a Windows or Linux target from a host of another OS |
output-in-content | error | output is inside Assets/ |
duplicate-name | error | two presets share a name (also rejected on load) |
glob | error | a glob is empty, absolute, has \ or .. |
loose-outside-assets | error | a loose glob does not start with Assets/ |
pack-key-missing | error | pack and encrypt on, but the project file has no saved packKey (fix: mf-export --init-pack-key, or open it in the editor) |
pack-key-invalid | error | MF_PACK_KEY is set but is not 32 bytes in base64 |
loose-without-pack | warning | loose globs with pack: false (everything ships loose anyway) |
steam-app-id / steam-debug | error / warning | see Steam |
notarize-needs-sign | error | a notary profile with ad hoc signing |
single-file | error / warning | error on macOS (a bundle), else experimental |
trim | warning | experimental for game code (JIT builds) |
native-aot-ignored | warning | nativeAot with singleFile, trim or selfContained: false (ignored) |
configuration | warning | neither Release nor Debug |
include-empty | warning | no include globs |
editor-only-content | warning | an include glob names Assets/Video, which never ships (the default Assets/** does not warn) |
broken-reference | warning | a shipped .mfscene/.mfres references an excluded file (ReferenceScanner: {"ref"|"instance": uid, "path"} objects and Assets/ strings; skipped when only translation sources are excluded) |
meta-excluded | warning | an exclude drops .mfmeta sidecars of shipped files |
icon | warning | the icon is missing, not a PNG, or under 256 px (where the platform needs one) |
version | warning | not MAJOR.MINOR.PATCH[-suffix] |
The editor saves every scene before an export (EditorCommands.SaveAll, as Play does) and does not start when a save
fails.
Editor: File › Export…
Section titled “Editor: File › Export…”See Editor → Export for the dialog, ExportService, the toolbar chip and the Output lines. File ›
Export… (file.export, Ctrl/Cmd+Shift+E, package-export) is enabled when the project has a desktop project.
Headless export: CLI, just, CI
Section titled “Headless export: CLI, just, CI”mf-export(just export …, ordotnet run --project Tools/MainframeEngine.Export.Cli -c Release --):--project <dir> --preset "<name>" [--output <dir>],--project <dir> --all,--project <dir> --list(the presets with ✓/⚠/✕ and their issues);- the legacy form
<Desktop.csproj> <rid> <out> [--name] [--exe] [--version] [--bundle-id] [--copyright] [--icon] [--sign] [--notarize] [--demo] [--steam] [--symbols ship|separate] [--configuration] [--folder], mapped onto an unsaved preset (just package-game). The project is the folder above the desktop project’s. --pack-list <Assets.mfpak>and--pack-extract <Assets.mfpak> <dir>show what a packed export ships (with--project <dir>orMF_PACK_KEYfor an encrypted pack);--project <dir> --init-pack-keysaves a pack key into a project that has none (an existing one is kept).- Exit codes: 0 exported, 1 a preset failed, 2 usage or validation error. Errors go to stderr in MSBuild’s canonical
format (
file : error code: text) so CI annotates them; the artifact is the last stdout line. Ctrl+C cancels.
- The package. The
MainframeEnginepackage carriesmf-exportintools/mf-export(managed files and runtimeconfig, likemf-l10n;build/pack-nuget.shbuilds it first).MainframeGame.propssetsMainframeExportToolto it (in a checkout: the CLI’s.csproj):dotnet "$(dotnet msbuild MyGame.Desktop -getProperty:MainframeExportTool)" --project . --preset Windows. - Editor flags (Godot’s names, in the editor repo):
MainframeEngine.Editor --project <dir> --export-release "<preset>" [<out>],--export-debug "<preset>" [<out>](configurationDebug, the file unchanged) and--export-allrunExportClifromProgram.csbefore anEditorAppexists (no window, SDL or engine), so the released editor exports from scripts. - CI.
build/template-smoke.sh(thetemplatejob, both engine sources) writes a preset for the host RID into the generated game’sproject.mfproj, runsmf-export --listand--preset, unpacks the archive, checks that onlyAssets.mfpakships (noAssets/folder, no looseproject.mfproj), checks it cannot be listed without the project’s key (it saves one with--init-pack-keyfirst), extracts it with--pack-extract --projectand checks the exportedproject.mfproj(no presets), the asset index, the engine’s content and the missing.po, and runs it with--headless --max-frames. The package run also packageslinux-x64,win-x64(andosx-arm64on a Mac) with the package’smf-exportin the legacy form and checks each archive.
Mobile (M12.7) extends the same schema
Section titled “Mobile (M12.7) extends the same schema”- Kept: mobile presets live in the same
exportarray with the common keys (name,platform,output,configuration,demo,version,icon,archive,include,exclude). - New platform values:
platform: "android" | "ios"selectAndroidExportOptions/IosExportOptions(IExportPlatformOptions) holding the drafted mobile keys;bundleIdis the macOS key. Today the reader rejects them with “update the engine”, so an older engine never drops a mobile preset. - Version name: the mobile draft’s
versionNameis the commonversion. - Pipeline:
ExportRunnergains platform steps behind anIExportPlatforminterface (desktop: publish → stage → bundle → archive; Android: cook → publish → APK/AAB signing; iOS: cook → build → archive). Validation, progress, Output, cancel, the CLI and the editor flags are shared. The Add Preset menu already lists Android and iOS, disabled. - Format: no bump is needed for new platform values.
Threading and allocation
Section titled “Threading and allocation”Export is editor and tool code; nothing runs per game frame. The runner works on the thread pool; ExportService.Update
drains its queues on the main thread and allocates only when there is something to report (a test checks an idle
Update allocates 0 bytes); RmlUi updates happen on the main thread. The runner never touches RmlUi, a scene tree or
AssetDatabase.Current: it builds its own AssetDatabase over the stage.
Testing
Section titled “Testing”- Settings (
Tests/MainframeEngine.Tests/Project/ExportPresetFormatTests.cs): the spec example parses and round trips, defaults are omitted, per-platform keys warn, bad presets throw with the key path, formats 1–4 upgrade with nothing else changed, the 4 → 5 step leaves the tree alone, a format-4 reader rejects a format-5 file, the Demo’s presets load. - Library (
Tests/MainframeEngine.Tests/Export/, no SDK): globs, the content filter, natives pruning (a fake table and the baked one), the exported project file, the reference scanner,.ico/.icnsparsed back, tar and zip modes,.partialcleanup on cancel, symbols, signing order and arguments, the Info.plist;ExportPlanvalues and arguments for every option and platform; every validation code;ExportRunnerend to end over a fakedotnet publishand fakecodesign/ditto/xcrun(Linux tar, Windows zip with icon, folder with separate symbols, macOS bundle ad hoc and notarized, invalid presets, missing Steam files, build errors, cancel, Run All, repeatable entries);mf-exportparsing (presets, legacy form, editor flags), exit codes and MSBuild-format errors. - Editor (
ExportEditorTests, editor repo):ExportServiceraises events only fromUpdateon the main thread, an idleUpdateallocates 0 bytes, an export waits for a running build and cancels; the presets model with undo; the Add menu; File › Export with its shortcut and enablement; the dialog edits, saves and exports; Play and Build & Reload wait; Output lines and diagnostics with their source. - Integration (
ExportIntegrationTests, editor repo,Slow, skipped without the .NET 11 SDK): a game from the template (temp folder), exported for this machine’s RID to a folder, its layout checked and run with--headless; a demo export whose assembly carriesMainframeDemo=trueand whose runtimeconfig disables the profiler. - Packs (G19 phase 2):
PackTestsand the mounted-content theories (engine tests, see Asset pipeline → Packs);ADefaultExportShipsTheContentAndTheProjectFileInAPack,PackFalseKeepsLooseAssetsandLooseGlobsShipBesideThePackAndStillLoad(runner); the integration export is packed (the demo one loose) and its run logsContent from Assets.mfpak.just export-smoke(local, needs a display and ImageMagick) exports the Demo packed and compares its screenshots with the loose Release build’s; the physics, particle and tile-map scenes vary run to run, so they are checked for errors only. - QA: the editor repo’s
Tests/QA/export.qacreates a game, adds a preset for this machine and exports it.
Changes from the proposal
Section titled “Changes from the proposal”- Format 5, not 3. Other milestones had taken formats 3 and 4; the step 4 → 5 is the empty bump the proposal described.
symbolsandprofilerpreset keys. G15 shippedpackage-game.sh --symbols ship|separateand its doc named G5’ssymbolsoption; the profiler doc named a per-preset profiler switch. Both are desktop keys.- No
win-icon-hostwarning. The G5.1 spike found that .NET 10 writes the exe icon (and the GUI subsystem) into the apphost from macOS, so Windows exports from any host get their icon. --artifacts-pathneeded an engine fix. The engine copied its Steamworks shim builds from their projects’bin/<cfg>/<tfm>/; under the artifacts layout it now takes them from the artifacts path.- Content filter scope. Only files that exist in the project’s
Assets/are filtered, so engine content always ships. - Signing ported to C# (
MacSigner) rather than run throughsign-app.sh, so exports from the package and the released editor need no script;sign-app.shstays for the editor’s release. LikewiseSymbolCollectorandcollect-symbols.sh. main-scene-excludedalso covers enabled autoload scenes and the bus layout;glob,include-empty,configurationcodes added;single-fileis an error on macOS (a single-file apphost cannot live in a bundle).- Legacy
--nameis anExportRequest.AppName(the.appand default exe name), not a preset key;--folderand--configurationwere added to the legacy form. - Mac exports in CI’s Linux template job are no longer packaged (they need a Mac); the fake-host runner tests cover the bundle layout and the template smoke covers it on macOS.
- The Output panel shows each result line but has no Show in Finder link (its rows open code); the dialog’s result rows have the reveal button.
- Mobile platforms are rejected by the reader for now (the proposal’s enum listed them as M12.7 values).
Related
Section titled “Related”- Release → Games · Editor → Export · Project and GameHost → Demo builds
- Steamworks → Export · Crash reporting → Symbols · Distribution via NuGet → Player builds
- Mobile core → Editor integration, the M12.7 presets that extend the schema