Kanject.Cli 2.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Kanject.Cli --version 2.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Kanject.Cli --version 2.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Kanject.Cli&version=2.0.0
                    
nuke :add-package Kanject.Cli --version 2.0.0
                    

Kanject.Cli

A single .NET global tool that drives C# AWS services from dotnet new to kanject aws deploy --env prod — wrapping the existing dotnet/AWS toolchain so your inner loop stays vanilla and the Lambda, ECS Fargate, static-site, and coupled full-stack deploy plumbing disappears behind one committed manifest.

Install

dotnet tool install --global Kanject.Cli

Requires the .NET 10 SDK or later (the .NET 11 SDK installs its .NET 11 build). The aws, msbuild, and github providers ship in the box — no extra installs.

Choose a workflow

  • Deploy applications: Lambda, ECS Fargate, or a coupled SPA/backend. Choose independent service roots, a shared multi-Lambda stack, or a coordinated frontend/backend pair.
  • Publish libraries: kanject packages init, then kanject packages plan and kanject packages verify from the package repository root.
  • Distribute desktop apps: initialize the product manifest, register with kanject add distributable, and configure delivery destinations.

Start at Getting started for workflow selection. Service commands run from the directory containing that service's manifest, which can differ from the repository or solution root. The current static-site shape requires a coupled backend.

Discover commands with kanject --help and kanject aws --help.

What it does

  • Bootstrap — kanject new scaffolds a project from a bundled template and initializes it; kanject init adds the manifest, stage files and lock file to an existing project.
  • Deploy — kanject aws deploy --env <stage> resolves cross-repo dependencies and env, builds the provider artifacts, and ships the manifest's target (Lambda, ECS Fargate, static site, or a coupled backend + site), recording every release in an S3 deployment ledger.
  • Rollback — kanject aws rollback --env prod shows the last 10 deployments with dates, statuses, targets, and commit summaries; pick one and Kanject does the target-native promotion with the prior artifact still immutable in S3/ECR.
  • And more — cross-repo dependency sync, a local test runner, env/param/secret management, static-site previews and ephemeral backend previews (kanject aws deploy --preview <NAME>), DynamoDB change feeds, a managed streaming Function URL and CloudFront edge, VPC & custom-domain wiring, multi-function services, AWS-native pipeline scaffolding, NuGet package publishing, desktop distribution, and sign-in for paid Kanject packages (kanject login, kanject add package).

It invokes — never replaces — dotnet new, dotnet build, and dotnet lambda, and drives AWS services through their SDK APIs (including CloudFormation change sets). The dotnet-native experience stays; kanject only owns the AWS plumbing that doesn't have a great answer in the box.

Learn more

License

Commercial — governed by the Kanject Code Libraries License Agreement (KCLLA); see the bundled LICENSE.md. © Kanject Business Solutions.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
2.5.0 103 11/16/2026
2.4.0 93 11/16/2026
2.3.0 113 11/15/2026
2.2.0 128 11/14/2026
2.1.0 96 11/13/2026
2.0.2 102 11/13/2026
2.0.1 94 11/13/2026
2.0.0 100 11/12/2026
1.5.1 123 11/11/2026
1.5.0 121 11/10/2026
1.4.0 106 11/4/2026
1.3.0 119 11/2/2026
1.2.0 157 11/1/2026
1.1.0 115 11/1/2026
1.0.79 111 10/30/2026
1.0.78 101 10/30/2026
1.0.77 108 10/29/2026
1.0.76 102 10/29/2026
1.0.75 100 10/29/2026
1.0.74 101 10/28/2026
Loading failed

- `kanject doctor --env <stage>` reads the stage file instead of only finding it.
 The stage check tested that `kanject-cli/stages/<stage>.json` existed, so doctor reported a file as ok and exited 0 while the next command stopped on it. Adding `artifactBucket` beside `aws` in the schema-2 stage file `kanject new` writes is the usual case: `kanject env --env dev` failed `KANCLI016` and `kanject doctor --env dev` passed. Doctor now loads the file through the reader every `--env` command uses and reports what that reader refuses as an error row with its code: `KANCLI016` (a key the file's schema version does not have), `KANCLI764` (an incomplete `aws` block), `KANCLI771` (a schema-1 file with settings inside `aws`), `KANCLI763`, `KANCLI767` and `KANCLI769` (the provider), and `KANCLI011`.
 - The row's message starts with the file's path, for example `kanject-cli/stages/dev.json: Manifest contains an unexpected field.`, and doctor exits 1.
 - The stage's own checks (network, domain, HTTP access, Native AOT, change feeds, BaaS modules) need a stage that loaded, so they do not run after that row. A stage file that loads gets the same rows as before.
 - A project whose doctor run passed in CI only because of this gap now fails there, with the code the deploy would have stopped on.

- A stage file that is empty or not JSON is `KANCLI011`, not a stack trace.
 Since 1.2.0 the stage reader looked for the file's `provider` before it checked that the file parsed, so `kanject env --env`, `kanject doctor --env` and the other commands that load a stage through it printed a `JsonException` stack trace for a truncated or empty file. They now report `Could not parse stage '<stage>' JSON.` with the parser's position. Reading a stage that records a `provider` also no longer fails on a manifest that does not parse; the manifest's own check reports that.

- A deploy stops when a Lambda entry's manifest and template disagree on the package type (`KANCLI777`).
 The manifest's `packageType` decides what kanject prepares (an ECR repository and an image tag, or neither) and the function in `template.json` decides what `dotnet lambda` builds, and nothing compared them. A `zip` entry over a function declared with `PackageType: Image` was prepared one way and built the other. `kanject aws deploy` now checks before it writes or builds anything, including `--dry-run` and `--preview`, and `kanject doctor` reports the same finding without deploying.
 - The message names the entry, the template file and the functions; the hint gives the edit for each direction, and for a function Amazon.Lambda.Annotations writes it names the attribute.
 - The file compared is the one the stage deploys: a hand-written `template.<stage>.json` when there is one, otherwise `template.json`.
 - Services scaffolded earlier from `webapi`, `tasks` or `instant-messaging` now stop on this code: those templates declared image functions while `kanject init` recorded `zip`. The "Package type" section of `docs/commands/deploy.md` gives the edits that make each a zip service.

- An image entry with no Dockerfile stops before the deploy starts (`KANCLI778`).
 It used to stop inside Amazon.Lambda.Tools, after kanject had prepared the deploy. The check looks where the function points (`Metadata.DockerContext` or `ImageUri`, and `Metadata.Dockerfile` or `Dockerfile`), and skips a function whose `ImageUri` is already an ECR image.

- `kanject init` and `kanject add function` read the package type from the base template too.
 `init` read it only from the `package-type` key of `aws-lambda-tools*.json`, and `add function` wrote `zip` whatever it had scaffolded. Both now record `image` when the project's `template.json` (or `serverless.template`) declares a function with `PackageType: Image`, and `init` gives each stage of such a service an `ecrRepository`.
 - `kanject init --package-type` overrides the detection for every entry. With `--yes` it set each stage's `ecrRepository` but left the entries as detected, so `--package-type image` wrote `zip` entries; the interactive wizard already applied it to all of them.

- The `instant-messaging` and `tasks` templates scaffold zip functions.
 As with `webapi`, the manifest already said `zip`; the templates now agree with it, so a new service passes the check above and deploys without Docker.
 - `instant-messaging`: the Api is declared with `Handler`, `Runtime` and `CodeUri`, and its Dockerfile is gone. The Api and the Connect functions get the runtime of the chosen framework (`dotnet8` for `net8.0`, `dotnet10` for `net10.0`); the Connect functions said `dotnet8` whatever was chosen.
 - `tasks`: the `[LambdaFunction]` attributes no longer set `PackageType = LambdaPackageType.Image`, for which the template never shipped a Dockerfile, and the shipped `template.json` is what Amazon.Lambda.Annotations writes from them.

- The manifest JSON Schema lists the `deployTarget` and `build.mode` values the CLI accepts.
 `kanject-cli/manifest.schema.json`, the copy `kanject init` and `kanject new` write for editor validation, was wrong on two value lists. Only editors read that file: no command's behaviour or diagnostic changes.
 - `deployTarget` listed `lambda`, `ecs-fargate` and `static-site`. It now also lists `function` and `container`, the kinds a schema-3 manifest uses and `kanject migrate --schema-v3` writes, so an editor no longer flags a migrated manifest.
 - `build.mode` listed `npm`, which the CLI refuses for every build (`KANCLI398` from doctor, `KANCLI441` at deploy). The list is now `sdk-publish`, `dockerfile`, `vite`, `cra` and `angular`.
 - The hint on `KANCLI427` for a static-site entry with no build descriptor named `npm` as a mode to use. It names `vite`, `cra` and `angular`.
 - An existing project keeps the schema copy it has until it is refreshed: `kanject init --refresh-schema` rewrites it, and `kanject migrate --schema-v3` does when it migrates the project.

- `kanject new` and `kanject add function` take `--package-type zip|image`.
 `webapi`, `tasks` and `instant-messaging` scaffold either package type a Lambda function can have. `zip` stays the default and is what `--yes` takes; interactive `kanject new` asks after the .NET version.
 - `image` scaffolds the function with `PackageType: Image` and a `Dockerfile` that copies the published project into the AWS Lambda base image for the chosen framework (`public.ecr.aws/lambda/dotnet:8-arm64` or `:10-arm64`). The Dockerfile the templates had through 1.5.1 said `dotnet:8-arm64` whatever framework was chosen.
 - `kanject init` reads the type from the scaffold, so the manifest entry is `image` and each stage gets an `ecrRepository`. For `instant-messaging` the choice is the Api's: with `--include-connect true` the Connect functions stay zip.
 - For `tasks` the choice is written in source, as `PackageType = LambdaPackageType.Image` on the `[LambdaFunction]` attributes, because Amazon.Lambda.Annotations writes `template.json` from them on every build.
 - `kanject new` prints what an image entry gives up: `kanject aws deploy --preview`, the managed HTTP endpoint and Function URL edge, Native AOT, and one build for several regions.
 - `minimal-api` and `file-server` are zip only. `--package-type image` with either, or a value that is neither `zip` nor `image`, stops before anything is scaffolded (`KANCLI779`).
 - Provider plugins offer the choice with the new `KanjectProjectTemplate.PackageTypeChoices`.

- An image entry on the scaffolded Dockerfile now builds.
 That Dockerfile copies `bin/Release/lambda-publish`, which `dotnet lambda` fills only when the config it loaded names `docker-host-build-output-dir`, and kanject passes its own generated config in place of `aws-lambda-tools-defaults.json`. The generated `aws-lambda-tools.<stage>.json`, and each per-entry config of a multi-entry deploy, now carries the key for an image entry: the project's own value when it has one, otherwise `./bin/Release/lambda-publish` when its Dockerfile copies that folder. A Dockerfile that builds the project itself gets no host publish.

- A deploy with an image entry checks for Docker first (`KANCLI780`).
 Without a daemon it used to create the ECR repository, write its files and then stop inside `dotnet lambda`. It now stops before anything is created or built. `kanject doctor --env` reports the same, and for a machine that has Docker it names the daemon and the host publish each image entry builds from. An entry whose image is already in a registry builds nothing and is not asked about.

- New command: `kanject aws configure package --type zip|image`.
 It switches a Lambda entry between a zip package and a container image in the project's files, all of them or none: the manifest entry's `packageType`, the functions of its `template.json`, a `Dockerfile` where an image entry has none, and `ecrRepository` in each stage file that names none.
 - `--dry-run` shows every file and writes nothing; `--entry` names the entry in a service that has several; `--json` prints the plan.
 - The template's other content is carried as written, so switching to an image and back leaves the file as it was. The folder a zip is built from (`CodeUri`) becomes the image's build context and back, and a Dockerfile, tag or build arguments the project named are kept through a zip. The generated Dockerfile's base image follows the project's framework and the entry's architecture. An existing Dockerfile is never overwritten. A stage's new `ecrRepository` is the repository a deploy already pushes to, its stack's name.
 - It also repairs a project whose manifest and template disagree (`KANCLI777`): `--type zip` on a service scaffolded from the 1.5.1 `webapi` template rewrites only its `template.json`. The `KANCLI777` hint now names the command.
 - For a function Amazon.Lambda.Annotations writes (the `tasks` template) it changes everything but the source, and names the one edit left: the `PackageType` of the `[LambdaFunction]` attributes.
 - It refuses, with `KANCLI781`, an entry that publishes Native AOT or that a managed `http` block fronts (both zip only), an entry that is not a Lambda function, a template it cannot read, and what an image function cannot have: `Layers`, or `Handler`, `Runtime`, `CodeUri` or `Layers` under `Globals.Function` (Lambda rejected these at the stack update, after the image was pushed). A file it cannot write is reported with the same code, and the files already written are put back.

- A deploy that would replace a deployed function stops first (`KANCLI782`), and `--replace-function` carries it through.
 Changing a function's package type makes CloudFormation replace it, deleting its versions and its `live` alias. kanject routes a function's triggers through that alias, so the stack update used to fail on the replacement, which has none yet; the remedy was to delete the alias by hand and deploy twice.
 - The deploy now reads the package type Lambda holds for each function that has a `live` alias, before it creates or builds anything, and stops when this deploy declares the other type. The read is one a deploy already makes, so it needs no new permission.
 - With `--replace-function` the replaced function is composed as on a first deploy: its triggers stay on the function, kanject creates `live` on the new function after the stack update, and the next deploy routes the triggers through it. Functions that keep their type are routed as usual. The flag does nothing, and says so, when no deployed function changes type.
 - On a stage that renders DynamoDB change feeds, a replaced drain gets a new stream mapping; the message and the warning say that records written in between are not delivered with `startingPosition: LATEST`, and the stream is read again with `TRIM_HORIZON`.
 - Not evaluated on a `--dry-run`, which reads nothing from the stack; refused with `--preview`.

- A rollback across such a replacement says so.
 A target from before the switch was refused as a pruned version (`KANCLI207`). The code is the same; the message now says the entry's function was replaced, names the function it runs as now and, when they differ, the two package types.

- `kanject aws pipeline up --help` names the default-stage key for both manifest layouts.
 The `--stage` description said the default was `manifest aws.defaultStage`, the schema 1 and 2 name. In the schema-3 manifest `kanject init` and `kanject new` write, that key is `deployment.defaultStage`; the description now gives both. The option's behaviour is unchanged.

- `kanject init --refresh-schema` brings a project's editor schema copies up to the CLI, and `kanject doctor` says when one is out of date (`KANCLI776`).
 `kanject init` and `kanject new` copy two JSON Schemas into a project, `kanject-cli/manifest.schema.json` and `kanject-cli/stage.schema.json`, so an editor checks the manifest and stage files as you type. No command reads the copies and nothing refreshed them in a project already on manifest schema 3, so after a CLI update an editor went on using the older CLI's rules.
 - `kanject init --refresh-schema` rewrites the copies that differ from the schemas embedded in the CLI you run, and nothing else. It runs in a project that already has a manifest, never overwrites that manifest (with or without `--force`), and does not open the lock file or a stage file for writing. A refreshed copy is byte for byte what a new scaffold gets.
 - A copy that is absent stays absent: a project that deleted its copies is left without them. A copy that already matches is left alone, so a second run changes nothing.
 - `kanject doctor` reports a copy that differs as one warning row, `KANCLI776`, naming the file and the command. It is never an error, the exit code does not change, and the check reads two local files: no network call.
 - A project still in the legacy `kanject/` directory is checked and refreshed there. Outside a project `--refresh-schema` stops with `KANCLI002` and creates nothing.
 - Every project scaffolded with 1.5.1 or earlier gets the `KANCLI776` row until it is refreshed, because its `manifest.schema.json` copy has the wrong `deployTarget` and `build.mode` lists. Run `kanject init --refresh-schema` and commit the file.

- `kanject new` and `kanject add function` no longer offer `net9.0`.
 The `tasks`, `instant-messaging` and `file-server` templates listed it beside `net8.0` and `net10.0`, as `webapi` did. Every Lambda template scaffolds zip functions, and AWS Lambda has no managed runtime for .NET 9, so such a service could be scaffolded and never deployed: kanject refuses a zip entry on it (`KANCLI215`), and for `tasks` a build made Amazon.Lambda.Annotations rewrite the template's runtime to `dotnet6`. The choices are now `net8.0` and `net10.0` for every Lambda template, and `--framework net9.0` is rejected when scaffolding.
 - A service already on `net9.0` keeps its files and is still refused at deploy. Retarget it to `net8.0` or `net10.0`, or publish it as Native AOT, which needs no managed runtime.

- A `file-server` service on `net10.0` gets the `dotnet10` runtime.
 Its template said `dotnet8` whatever framework was chosen, so a `net10.0` service was deployed onto a runtime that cannot load it. The function's `Runtime` now follows the framework, as in the other templates.

- A deployed `webapi` service answers requests; it answered 500 to every one.
 The Api's `Startup` gives Swagger the project's XML comments file, `<assembly>.xml` in the application's folder, and the project wrote that file only in the Debug configuration. Every deploy publishes Release, so the file was missing, and `UseSwagger()` builds the Swagger options, which open the file, for each request whatever its path: `FileNotFoundException: Could not find file '/var/task/<assembly>.xml'`. The Api project now sets `GenerateDocumentationFile` in every configuration, as `minimal-api`, `file-server` and `tasks` do, so the file is in the publish output and the deployed OpenAPI document carries the controllers' comments. A zip entry and an image entry publish the same way and both failed.
 - The `instant-messaging` Api had the same gap and gets the same fix. Its Debug build wrote the file into the project folder, from where a later Release publish copied it, so it failed only where no Debug build had run first, such as a clean checkout in CI. The file is no longer written into the project folder.
 - A service scaffolded earlier keeps its files. To fix one, in `src/<Name>.Api/<Name>.Api.csproj` add `<GenerateDocumentationFile>true</GenerateDocumentationFile>` to the first `PropertyGroup` and delete the `<DocumentationFile>` line from the `Debug|AnyCPU` group, then deploy again. In an `instant-messaging` Api also delete the `<None Update="<Name>.Api.xml">` item and the `<Name>.Api.xml` file beside the project.

- `kanject new webapi` scaffolds a zip function, so the service deploys without Docker.
 The template's `template.json` declared an image function (`PackageType: Image`, with a Dockerfile) while `kanject init` recorded the entry as `packageType: "zip"`: init reads the package type from `aws-lambda-tools*.json`, and the template named none there. `kanject aws deploy` then prepared a zip deploy, with no ECR repository and no image tag, and Amazon.Lambda.Tools, which packages by the template, took the image path: it needs Docker and a published `bin/Release/lambda-publish` directory that nothing in that flow produces. The function is now declared the way `minimal-api`'s is, with `Handler`, `Runtime` and `CodeUri`, and the Dockerfile is gone.
 - The runtime follows the framework: `dotnet8` for `net8.0` (still the default) and `dotnet10` for `net10.0`.
 - `--framework net9.0` is no longer offered for `webapi`, in `kanject new` or `kanject add function`. Lambda has no managed runtime for it, and kanject already refused to deploy a zip entry on it (`KANCLI215`). `dotnet new` now rejects the value when scaffolding.
 - A service scaffolded earlier keeps its files. To convert one by hand, in `template.json` replace `PackageType`, `ImageConfig` and `ImageUri` with `Handler` (the string under `ImageConfig.Command`), `"Runtime": "dotnet8"` (`dotnet10` on `net10.0`) and `"CodeUri": ""`, and remove the function's `Metadata` block; then delete the `Dockerfile` and remove `docker-host-build-output-dir` from `aws-lambda-tools-defaults.json`.

- Kanject runs on .NET 10 and .NET 11.
 The tool and its bundled providers ship a `net10.0` build and a `net11.0` build; they shipped one `net8.0` build, and .NET 8's support ended on 2026-11-10. `dotnet tool install` and `update` take the newest build the SDK can run, so the .NET 10 SDK gets the .NET 10 build and the .NET 11 SDK the .NET 11 one. A machine with only the .NET 8 or 9 runtime can no longer install or run the tool: install the .NET 10 SDK or later. Later runtimes still run it (`RollForward` stays `LatestMajor`).
 - Nothing changes for the projects it scaffolds, builds and deploys: `net8.0` and `net10.0` services keep their zip functions on `dotnet8` and `dotnet10`.
 - Pipelines on CodeBuild's .NET 10 image keep working unchanged: their .NET 10 SDK installs the .NET 10 build.
 - The .NET 11 build is built with .NET 11 Runtime Async (a preview feature of .NET 11): the runtime runs its async methods instead of compiler-generated state machines. Its assemblies are 14 to 22% smaller, `kanject --help` starts about 3% sooner, and a live stack trace (the debugger's, a profiler's) shows the real call chain. Exception stack traces read as before.
 - The .NET 11 build has no `Microsoft.Extensions.DependencyInjection.Abstractions` of its own: .NET 11 ships it in the shared framework, and the host and its providers bind that copy.
 - `kanject update` now verifies the signed providers of every build in the installed package, not only the first it finds.

- `webapi`, `tasks` and `instant-messaging` scaffold `net11.0`, as a container image.
 AWS Lambda has no managed runtime for .NET 11 and AWS publishes no Lambda base image for it, so `kanject new --framework net11.0` (and `kanject add function`) scaffolds an image whose `Dockerfile` starts from `mcr.microsoft.com/dotnet/aspnet:11.0-resolute-arm64v8` and whose app is its own Lambda runtime (Amazon.Lambda.RuntimeSupport): `LocalEntryPoint.Main` runs the runtime loop inside Lambda and Kestrel anywhere else, and `tasks` turns on the `Main` that Amazon.Lambda.Annotations generates. The version prompt labels `net11.0` as an image only and skips the package type prompt; `--package-type zip` with it stops before anything is scaffolded (`KANCLI779`). `instant-messaging`'s Connect functions stay zip packages on `net10.0`. `minimal-api` and `file-server`, which are zip only, do not offer it.

- `kanject aws deploy` takes an image entry on any framework.
 An image builds from its Dockerfile, so it no longer needs a managed Lambda runtime: a `net11.0` image entry stopped with `KANCLI215` through 1.5.1. For a framework Lambda has no runtime for, the generated `aws-lambda-tools` config names no `function-runtime`, so the host publish stays framework-dependent. `KANCLI215` for a zip entry no longer suggests Native AOT for a framework with no Lambda AOT build image, such as `net11.0`.

- `kanject aws configure package --type image` refuses an entry on a framework with no managed runtime (`KANCLI781`), such as `net11.0`: there is no AWS base image for its Dockerfile, and the runtime loop is code the command does not write. It names the scaffold that has one.