Skip to content

Nuspec Reference

The virtufin* extension elements in the worker nupkg's .nuspec are read by Virtufin.Worker.DevKit (the VirtufinWorkerNuspec class) and by the WorkManager engines' WorkerNupkgLoader in the Runtime. They tell the engine which file in the nupkg is the worker (DLL or .so), what C-ABI function names to resolve, and what ABI version the worker targets.

The fields

Field Type Purpose
<id> string The NuGet package id (e.g. Virtufin.Worker.HttpGet). Worker.DevKit's target takes it from the csproj's <PackageId>.
<version> string LIBRARY_VERSION from the worker's versions.env. virtufin-worker build passes it as -p:PackageVersion; the csproj holds a placeholder.
<authors> string "Virtufin".
<description> string "HttpGetWorker worker for the WorkManager" (managed) or "...(NativeAOT)" (AOT).
<virtufinAbiVersion> int The native worker ABI version: 2 (WorkManager 0.28.0+, the worker wire protocol: a protobuf CloudEvent in, a protobuf CloudEventBatch out). The NativeDllEngine rejects a nupkg whose value isn't in VirtufinWorkerNuspec.SupportedAbiVersions ({ 2 }).
<virtufinEntryPoint> string The C-ABI function name for the dispatch entry point. Default "Process". The engine calls NativeLibrary.GetExport(handle, "Process") to resolve it.
<virtufinFreeResult> string The C-ABI function name for the result-free callback. Default "FreeResult". The engine calls NativeLibrary.GetExport(handle, "FreeResult") after each Process call.
<virtufinLibrary> string The basename of the worker file (no extension). For a managed nupkg, this is the worker DLL's basename (e.g. HttpGetWorker). For an AOT nupkg, this is the basename of the .so (e.g. HttpGetWorker — the AOT build renames HttpGetWorker.so to libHttpGetWorker.so at build time).

The contract

The nupkg must have exactly one virtufinLibrary value. virtufin-worker build --native publishes the managed nupkg's nuspec (written by Worker.DevKit's VirtufinPackageWorker target) with the native runtimes/ added, so it has a single virtufinLibrary that resolves to either the managed DLL or the AOT .so depending on which engine loads the nupkg.

The other virtufin* fields are advisory for the AOT path only (the managed engine doesn't read them — it uses reflection on IWorker to discover the worker class). For a managed-only nupkg, the virtufinEntryPoint / virtufinFreeResult / virtufinLibrary fields are still required by the schema but are not read at load time.

Defaults

Worker.DevKit's VirtufinPackageWorker target defaults the virtufin* fields to: - virtufinAbiVersion = 2 - virtufinEntryPoint = Process - virtufinFreeResult = FreeResult - virtufinLibrary = <AssemblyName> (the csproj's assembly basename)

These match the VirtufinWorkerNuspec.Default* constants. Override them with the csproj properties VirtufinWorkerAbiVersion, VirtufinWorkerEntryPoint, VirtufinWorkerFreeResult and VirtufinWorkerLibrary if your worker exports different names (e.g. you have multiple C-ABI entry points and want to mark a custom one).

The full nuspec shape (managed)

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>Virtufin.Worker.HttpGet</id>
    <version>0.6.4</version>
    <authors>Virtufin</authors>
    <description>HttpGetWorker worker for the WorkManager.</description>
    <virtufinAbiVersion>2</virtufinAbiVersion>
    <virtufinEntryPoint>Process</virtufinEntryPoint>
    <virtufinFreeResult>FreeResult</virtufinFreeResult>
    <virtufinLibrary>HttpGetWorker</virtufinLibrary>
  </metadata>
</package>

The full nuspec shape (AOT, combined-managed-and-AOT nupkg)

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>Virtufin.Worker.HttpGet</id>
    <version>0.6.4</version>
    <authors>Virtufin</authors>
    <description>Virtufin worker nupkg (managed + NativeAOT).</description>
    <virtufinAbiVersion>2</virtufinAbiVersion>
    <virtufinEntryPoint>Process</virtufinEntryPoint>
    <virtufinFreeResult>FreeResult</virtufinFreeResult>
    <virtufinLibrary>HttpGetWorker</virtufinLibrary>
  </metadata>
</package>

The <description> text varies by mode; the rest is identical.

The wire contract summary

Surface Owner Where it lives
<PackageId> (NuGet id) wire csproj <PackageId> (virtufin-worker create derives the feed URL from it)
<version> wire versions.env LIBRARY_VERSION (virtufin-worker build passes it as PackageVersion)
<virtufinLibrary> wire csproj <AssemblyName> (managed and AOT must agree)
<virtufinAbiVersion> engine csproj VirtufinWorkerAbiVersion (default 2)
<virtufinEntryPoint> engine csproj VirtufinWorkerEntryPoint (default Process)
<virtufinFreeResult> engine csproj VirtufinWorkerFreeResult (default FreeResult)

The wire rows are the contract between worker author and consumer (the script that downloads + uses the nupkg). The engine rows are the contract between worker author and the Runtime's NativeDllEngine.

See also