Packaging Modes
A worker nupkg can ship in three packaging modes: managed, native, or both. virtufin-worker build produces managed (default) or both (--native). The choice depends on whether you need one engine, both, or want to defer the engine choice to deploy time.
Mode 1: managed only
virtufin-worker build HttpGet
Output: <PackageId>.nupkg containing lib/<tfm>/<AssemblyName>.dll (the worker assembly only; its NuGet dependencies are declared in the nuspec and installed by WorkManager at load time). Worker.DevKit's shared VirtufinPackageWorker target writes it after dotnet publish (the csproj sets VirtufinPackageWorker=true); the CLI writes build_version.txt. Use this when:
- You only target the
DotNetDllEngine(managed). This is the default. - The worker is in active development (the managed path is easier to debug).
- The worker has un-AOT-portable dependencies.
The nupkg can be registered with application/x-dotnet-dll only.
Mode 2: native only
No longer built on its own: virtufin-worker build --native produces mode 3, which an application/x-native-dll worker loads the same way. The native layout is runtimes/<rid>/native/lib*.so (per-arch native libraries). The AOT csproj sets <PublishAot>true</PublishAot>, <RuntimeIdentifiers>linux-x64;linux-arm64</RuntimeIdentifiers>, and per-RID <ObjCopyName> (the cross-binutils binaries from the cross-build image). The CLI invokes dotnet publish -r <RID> --publish-aot inside the docker.haenerconsulting.com/library/dotnet-crossbuild:11 image (which provides clang + cross-binutils — the host machine rarely has them natively). Each RID's output is renamed to lib<AssemblyName>.so per NuGet convention, and a .supported-rids sidecar manifest is written at the nupkg root.
Use this when:
- You only target the
NativeDllEngine(NativeAOT, loaded into the Runtime process). - You have a reason to run native code (see Engines).
- The worker is fully trusted: a crash in it takes down the Runtime pod and every worker it hosts.
- All its dependencies are AOT-compatible; they are compiled into the
.so.
The nupkg can be registered with application/x-native-dll only.
Mode 3: both (single nupkg, both layouts)
virtufin-worker build HttpGet --native
Output: a single <PackageId>.nupkg containing both lib/<tfm>/*.dll AND runtimes/<rid>/native/lib*.so. The CLI runs the managed build, AOT-publishes each RID, and adds the native libraries and .supported-rids to the managed nupkg, whose nuspec is the package's only one.
Use this when:
- You want one deployable artifact that supports either engine.
- You want to compare managed and native side by side (create one worker with
application/x-dotnet-dlland another withapplication/x-native-dll, both from the same nupkg URL). - You want a staged rollout (deploy AOT, drain managed, eventually switch to AOT-only — but keep the option to roll back to managed without changing the artifact).
The combined nupkg can be registered under either or both MIME types.
How it is built
See Build Script for what virtufin-worker build does in each mode.
What the nupkg contains in each mode, the MIME-type contract and versioning: Nupkg layout.
See also
- Build Script — what
virtufin-worker builddoes - Runtime Arch Check — how the
.supported-ridssidecar is consumed - Engines — managed, native and Python for the workers here