# NuGet

Recommend AXM extensions from a NuGet (.NET) package and target NuGet packages from an extension.

AXM reads .NET extension metadata from an `agent-extensions.json` sidecar at the
package root. This is the [two-way linking](/docs/package-ecosystems/overview)
model applied to the NuGet ecosystem.

## Recommend extensions from a package

Add an `agent-extensions.json` file at the package root and ship it in the
published `.nupkg`. It carries an `agentExtensions` array where each entry is an
extension reference (`@owner/<type>/<name>`):

```jsonc
// agent-extensions.json
{
  "$schema": "https://axm.sh/schemas/agent-extensions.schema.json",
  "agentExtensions": [
    { "ref": "@examples/packs/dotnet-csharp-nuget-tinyflags" },
  ],
}
```

Keep recommendations **identity-only** — omit `versionRange`. AXM resolves the
reference to the newest matching extension version and pins it in the user's
`axm.lock`. Prefer recommending a single **pack** so you keep one stable
reference while its contents evolve.

Add a semver `versionRange` only when your package genuinely pairs with a
bounded major line of the extension:

```jsonc
{
  "agentExtensions": [
    {
      "ref": "@examples/packs/dotnet-csharp-nuget-tinyflags",
      "versionRange": "^1.0.0",
    },
  ],
}
```

## Target NuGet packages from an extension

On the extension manifest (`skill.json`, `pack.json`, `subagent.json`, …), add a
`packages` array with a NuGet [purl](https://github.com/package-url/purl-spec):

```jsonc
// pack.json
{
  "packages": [{ "purl": "pkg:nuget/AgentXM.Examples.TinyFlags.CSharp" }],
}
```

Use the package id as published to NuGet.org as the purl name; NuGet ids are
case-insensitive.

### Version ranges

Default to identity-only. Add a [VERS](https://github.com/package-url/vers-spec)
`versionRange` with the `nuget` scheme only when the extension depends on
package APIs introduced or removed in a known range:

```jsonc
{
  "packages": [
    {
      "purl": "pkg:nuget/AgentXM.Examples.TinyFlags.CSharp",
      "versionRange": "vers:nuget/>=0.1.0|<1.0.0",
    },
  ],
}
```

## Official status

When the NuGet package recommends an extension through the AgentXM Registry
**and** that extension names the package as a companion via its purl, AXM
derives **official** status for the pair — no extra flag. See
[Official extensions](/docs/package-ecosystems/overview#official-extensions).

## Reference fixture

The
[`dotnet-csharp-nuget-lib`](https://github.com/agentxm/polyglot-examples/tree/main/dotnet-csharp-nuget-lib)
and
[`dotnet-csharp-nuget-app`](https://github.com/agentxm/polyglot-examples/tree/main/dotnet-csharp-nuget-app)
directories in `polyglot-examples` are the working fixtures for everything above
(an F# pair lives alongside them). The package publishes a TinyFlags companion
pack and recommends it from the `agent-extensions.json` sidecar; the pack and
each skill declare the package's NuGet purl as an identity-only companion
package.