Skip to content

How to: F&O interop library (net48)

How-to · Core Studio 3.0 · Verified 2026-09-01

Goal: an X++-callable .NET library, built and deployed end-to-end from the Studio: build → DLL+PDB into the model’s bin → AxReference AOT element → X++ wrapper class → xppc compile. Proven on-VM with a passing runtime call.

Why net48: the AOS’s CLR is .NET Framework — net48 is the interop contract. The template carries the pinned Microsoft.NETFramework.ReferenceAssemblies package, so it builds with the .NET SDK alone — no Visual Studio, no targeting packs.

Prerequisites

  • The .NET SDK on the machine.
  • A project with a companion slot (see workspaces & projects); the target model for deployment builds green.

Steps

  1. Add the companion: Projects pane → Add C# Companion Project… → F&O interop library (net48). You get an SDK-style csproj, a sample class, and a README leg.
  2. Write your library — full csharp-ls language server: diagnostics, completion, hover, go-to-definition, references.
  3. Add F&O Reference… — pick a model from the metadata index; the Studio writes the Dynamics.Ax.<Model> + support assembly references with hint paths from the active environment profile. Now the language server completes F&O types (DataEventType, JoinMode, …) with zero assembly-load failures.
  4. Build + Deploy Interop Library… — one staged, cancellable pipeline: build the companion → copy DLL + PDB into PackagesLocalDirectory\<Model>\bin and write the required AxReference element → scaffold the X++ wrapper class → compile the model with xppc.

Verify it worked

  • Every stage prints an honest verdict; the model compiles with the AxReference in place.
  • The end-to-end proof this flow was certified against: an X++ SysTest calling the C# method passes at runtime.

If it goes wrong

  • X++ can’t see your library — the AxReference element is the piece people forget; the pipeline writes it for you, but if you deployed manually, that’s the missing step.
  • Reference completion dead — re-run Add F&O Reference…; hint paths come from the active environment profile (see environment profiles).

Next: debugging companions (note the net48 boundary there) · dotnet test.