Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/

NativeAOT Deployment

Edit on GitHub

Publish OfficeIMO applications as native executables, choose AOT-safe APIs, and understand optional integration boundaries.

The project inventory distinguishes NativeAOT evidence from managed deployment. 116 of 127 production projects publish and execute in NativeAOT validation. The Chromium browser-PDF bridge, local HTML/PDF workbench, and Avalonia-based OfficeIMO Studio use managed cross-platform deployment. The Project library, invoice engine, optional PDF adapter and standards validator use managed cross-platform deployment. The document-AI engine, IntelligenceX adapter and headless example target managed .NET 10; NativeAOT support for those projects is not claimed. The WPF/WebView2 renderer is tested as a managed Windows component because the .NET SDK rejects trimming for WPF executables (NETSDK1168).

The 116 native-validated projects are not all proved in the same way:

  • 113 production libraries are fully rooted as complete assemblies across three native hosts: 111 in the main compile graph, with the optional OfficeIMO.Security and OfficeIMO.Provenance.C2pa packages each exercised in a dedicated host. All three executables must start successfully.
  • 1 optional Google APIs adapter runs a bounded token-store workflow natively. Its complete Google authorization dependency surface is not advertised as trim-safe because fully rooting Google.Apis and Newtonsoft.Json produces upstream warnings.
  • 1 production command-line tool publishes as a native executable and must start and return its real command help.
  • 1 build-time source generator emits an explicit row mapper that compiles into and executes from the main native host. The analyzer itself is not deployed as a runtime assembly.

The machine-readable project matrix names all 127 production projects and records which proof applies to each one. A passing native workflow does not establish that every optional third-party API has been executed.

OfficeIMO.Project has additional bounded Linux NativeAOT lifecycle smoke evidence described in its Project runtime and scale support. It is not counted in the coordinated native hosts above; full-library rooting remains unqualified.

Publish your application

Use .NET 8 or .NET 10 and enable NativeAOT in the application that consumes OfficeIMO:

<PropertyGroup>
  <TargetFramework>net10.0</TargetFramework>
  <PublishAot>true</PublishAot>
</PropertyGroup>

Publish for the operating system and architecture you plan to deploy:

dotnet publish -c Release -r win-x64
dotnet publish -c Release -r linux-x64

NativeAOT evaluates your complete application, including every package and code path you use. Run the published executable and assert the generated or extracted document content before shipping it.

The Word, Excel, PowerPoint, and Word-to-HTML packages use the Microsoft Open XML SDK in the supported range [3.5.1, 4.0.0). Normal OfficeIMO consumers receive that dependency transitively. If your application references DocumentFormat.OpenXml directly, keep its resolved version inside the same range so the dependency graph matches the versions validated by OfficeIMO.

Project-level coverage

Production classificationProjectsWhat CI provesCustomer guidance
Fully rooted libraries113The complete assembly surfaces compile into NativeAOT executables on Windows and Linux: 111 libraries in the main host, with OfficeIMO.Security and OfficeIMO.Provenance.C2pa each exercised in a dedicated host. All three executables must start.These packages are suitable NativeAOT building blocks; still test the exact documents and options your application uses.
Bounded Google APIs adapter1OfficeIMO.GoogleWorkspace.Auth.GoogleApis constructs its data-store adapter and round-trips a value in the native executable.The validated adapter path is native. Treat live OAuth/provider flows as application-specific until your chosen Google dependency graph publishes cleanly.
Native command-line tools1OfficeIMO.Tool publishes and starts as a native executable on Windows and Linux with namespaced HTML, Reader, and Markup commands.Native CLI deployment is supported; validate the concrete commands and formats used by your job.
Native build analyzer1OfficeIMO.Data.Generators emits a row-mapping plan that compiles into and executes from the native host.Install the analyzer at build time; only its generated application code is deployed.
Managed cross-platform applications and integrations9OfficeIMO.Html.Pdf.Browser and the local HTML/PDF workbench use the managed HtmlTinkerX and Playwright runtime; OfficeIMO Studio uses the managed Avalonia desktop runtime. OfficeIMO.AI, OfficeIMO.AI.IntelligenceX, and OfficeIMO.AI.Example target managed .NET 10. OfficeIMO.Invoicing, OfficeIMO.Invoicing.Validation, and OfficeIMO.Invoicing.Pdf provide managed invoice authoring, optional standards validation, and PDF presentation.Use managed .NET deployment for these applications and integrations; do not advertise them as NativeAOT-compatible without separate native-publish proof.
Managed Windows UI1OfficeIMO.MarkdownRenderer.Wpf builds and runs through the managed Windows/WPF test lane.Do not enable NativeAOT for this WPF/WebView2 UI package. Use the managed Windows deployment model.

CI fails if a production project is added, removed, or renamed without being classified in this matrix.

Executed document workflows

The repository publishes one namespaced native command surface while keeping each document workflow in its owning library.

Product areawin-x64linux-x64Native executable verifies
WordPassPassCreate a DOCX, save it, reopen it, and read the expected paragraph.
ExcelPassPassCreate a typed table, save it, reopen it, and read typed tabular data.
PowerPointPassPassCreate a chart and its embedded workbook, duplicate the slide and relationships, save, and reopen both charts.
MarkdownPassPassCompose and render a document through the fluent API.
CSV and tabular adaptersPassPassParse CSV, execute generated row mapping, and create a bounded Apache Arrow batch.
Reader CSVPassPassRoute CSV through the focused adapter and read normalized table chunks.
Reader complete presetPassPassRegister all 30 local in-process handlers and perform representative structured extraction.
HTML, PDF, and imagesPassPassRender HTML to SVG and PNG, create a searchable PDF, and read marker text back.

These eight document workflows complement the project-level compile matrix with behavior and output checks. They are useful end-to-end baselines, not a claim that every possible document, option, or third-party service has been exercised. Add your templates, accepted formats, fonts, and representative source files to your application tests.

Package-family guidance

Package familyNativeAOT guidance
OfficeIMO.Word, OfficeIMO.Excel, OfficeIMO.PowerPointUse the normal typed document APIs. The common create, edit, relationship, save, and reload paths are covered by native executables.
OfficeIMO.Markdown, OfficeIMO.CSV, OfficeIMO.Html, OfficeIMO.PdfIn-process composition, parsing, and rendering are AOT-friendly. Validate output fidelity with your real content.
OfficeIMO.Data.Arrow, OfficeIMO.Data.GeneratorsArrow batches and source-generated row mapping run in the native host. The generator is a build-time analyzer and is not part of the runtime deployment.
OfficeIMO.Reader.*The OfficeIMO.Reader.All preset registers all local format handlers in NativeAOT. Add only the adapters you need when binary size matters.
Format and conversion adaptersThe complete production library assemblies are rooted in the native compile graph. Test the exact conversion direction and fidelity your application accepts.
Google Workspace, Confluence, and other network clientsThe dependency-light OfficeIMO client libraries are fully rooted in the native matrix. The optional Google.Apis credential adapter has a bounded native token-store test; publish and test the live authentication and HTTP provider selected by your application.
OCR process and Tesseract adaptersThe OfficeIMO host adapter can be native; OCR still runs in the configured external executable and must be deployed separately.
Chromium browser-PDF bridgeUse managed cross-platform deployment. OfficeIMO.Html.Pdf.Browser delegates browser capture to HtmlTinkerX and Playwright, then opens the result through OfficeIMO.Pdf.
OfficeIMO StudioUse the checked-in managed Avalonia distribution profiles for Windows, Linux, and macOS. The current desktop application is not advertised as NativeAOT-compatible.
WPF/WebView2 rendererUse managed Windows deployment. The .NET SDK currently rejects trimmed WPF executables with NETSDK1168, so OfficeIMO does not market this package as NativeAOT-compatible.

Prefer typed data paths

NativeAOT works best when types are visible to the compiler. OfficeIMO's normal document APIs already follow that model. APIs that inspect an arbitrary runtime object graph are marked so the compiler can warn at the call site.

Recommended patterns include:

  • write Excel tables from DataTable, explicit cell values, or typed row mappings;
  • read Excel rows with generic typed readers whose model type is known at publish time;
  • build Word tables from explicit columns and cells when the model shape is dynamic;
  • use generic Markdown object/table builders or dictionary-based data when fields are selected at runtime;
  • register Reader adapters explicitly, or use AddAllOfficeIMOHandlers() for the complete local preset.

If your application loads plug-ins, type names, templates, or model members dynamically, preserve those members in the application or replace discovery with an explicit mapping. This is an application boundary rather than an OfficeIMO-specific switch.

Validate the deployment you will ship

A practical NativeAOT acceptance test should:

  1. publish for the target runtime identifier;
  2. start the produced native executable;
  3. create, convert, or read a representative document;
  4. reopen the output where the format supports it;
  5. assert useful content such as text, tables, formulas, slides, relationships, or searchable PDF text.

OfficeIMO contributors can run the checked-in matrix for the current machine:

./Build/Test-AotScenarios.ps1

The script first validates the production-library host, then runs the eight document workflows and the two production CLI startup checks. Each scenario receives a fresh SDK artifacts directory, so a Linux run cannot consume Windows obj metadata and one scenario cannot reuse another scenario's native state. The same matrix runs in repository CI on Windows and Linux. Optional JSON results can be retained for deployment evidence:

./Build/Test-AotScenarios.ps1 -JsonOutputPath ./artifacts/aot-results.json
./Build/Test-AotProjectCoverage.ps1 -JsonOutputPath ./artifacts/aot-project-matrix.json

Trimming, ReadyToRun, and single-file deployment

These deployment modes solve different problems:

GoalSetting
Native executable and fast startup<PublishAot>true</PublishAot>
Smaller managed deployment<PublishTrimmed>true</PublishTrimmed>
Faster managed startup with broader runtime compatibility<PublishReadyToRun>true</PublishReadyToRun>
One managed deployment file<PublishSingleFile>true</PublishSingleFile>

Do not copy warning suppressions from another application. Treat every trim or AOT warning at your call site as a request to choose a typed API, preserve an intentionally dynamic model, or remove a dependency that cannot support the deployment target.

Example source

Download source