Installation

View .md

Kanject ships as a .NET global tool — but you don't need any prior .NET setup to install it. Start at the top: install the SDK if this machine has never run .NET, install the CLI, then run kanject doctor to confirm everything is wired up. If something fails, Common installation issues is ranked by how often each failure actually happens.

You'll learn
  • Install the .NET SDK itself if you're coming from Node, Python, Go, or any non-.NET stack
  • Verify the common .NET foundation, then install only the tools your shipping path needs
  • Install the kanject CLI as a .NET global tool from public NuGet
  • Fix the most common setup failure — kanject not found on PATH — on macOS, Linux, and Windows
  • Confirm the setup with kanject doctor, and know how to upgrade or uninstall

Install the .NET SDK first

kanject rides on the .NET SDK — but you may already have it. One command tells you:

bash
dotnet --version
What did dotnet --version print?
10.0 or higher — the SDK is already here

You're set — skip straight to Verify the toolchain. kanject installs on top of the SDK you already have; there's nothing else .NET-specific to do.

command not found — or a version below 10.0

Install the SDK — pick your OS below. Whether you're coming from Node, Python, Go, or anywhere else, this is the only .NET-specific setup you'll do:

powershell
winget install Microsoft.DotNet.SDK.10dotnet --version       # 10.0 or higher works
bash
brew install --cask dotnet-sdkdotnet --version       # 10.0 or higher works
bash
# official install script — installs to ~/.dotnetcurl -fsSL https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 10.0echo 'export PATH="$HOME/.dotnet:$HOME/.dotnet/tools:$PATH"' >> ~/.bashrcsource ~/.bashrcdotnet --version       # 10.0 or higher works

Or skip the terminal entirely: download the installer from the official .NET website below and run it — pick the SDK, not the Runtime.

Download from the .NET website

Either way, open a new terminal afterwards and re-run dotnet --version — 10.0 or higher means you're ready to continue.

Verify the toolchain

The .NET 10 SDK is the common requirement. The remaining checks are path-specific: AWS CLI + Lambda tools for service deployment, git for cross-repository dependencies, and AWS CLI when desktop downloads use S3 destinations.

bash
dotnet --version       # 10.0 or higheraws --version          # aws-cli/2.xgit --version          # git version 2.xdotnet lambda --version

A missing path-specific tool does not block an unrelated package workflow. Install it before entering the command family that uses it; kanject doctor and doctor --features report requirements in the context of the repository and feature being checked.

Install the AWS Lambda tooling

Required by kanject aws deploy (Lambda packaging) and kanject test (local Lambda TestTool):

bash
dotnet tool install -g Amazon.Lambda.Toolsdotnet tool update  -g Amazon.Lambda.Tools

Install kanject

The CLI ships on public NuGet — no feed credentials, no --add-source:

bash
dotnet tool install -g Kanject.Cli

First-run check

bash
kanject --versionkanject doctor

Without --env, doctor only checks the foundations: the .NET SDK, the global-tools PATH, and the manifest if you're inside a kanject project. A clean run looks like:

bash
✓ dotnet 10.0.x✓ global tools on PATH (~/.dotnet/tools)✓ kanject-cli/manifest.json (schema v1)ok: 3   warn: 0   error: 0

If you're not inside a kanject project yet, the manifest check is skipped — that's expected. The next step is Quick Start.

Common installation issues

Ranked by how often they hit — start at the top. Each one ends with kanject --version resolving.

1 · kanject is not found — any OS. This is the failure behind nearly every installation report. What it looks like:

text
# macOS / Linux (zsh)zsh: command not found: kanject# Windows (PowerShell)kanject : The term 'kanject' is not recognized as the name of a cmdlet,function, script file, or operable program.

The cause: dotnet tool install puts the binary in ~/.dotnet/tools (%USERPROFILE%\.dotnet\tools on Windows) but does not put that folder on your PATH — it only prints the line you'd need. The tool is installed; your shell just can't see it. Confirm that first:

bash
dotnet tool list --global              # lists kanject.cli if the install workedls ~/.dotnet/tools                     # macOS / Linuxdir $env:USERPROFILE\.dotnet\tools     # Windows

Add the folder to PATH — pick your OS:

powershell
# 1 — fix the window you're in right now (session only)$env:Path += ";$env:USERPROFILE\.dotnet\tools"kanject --version# 2 — persist for every future window (writes the User PATH only)[Environment]::SetEnvironmentVariable(  "Path",  [Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\.dotnet\tools",  "User")

Two commands because registry PATH changes never reach already-open terminals — the first fixes the window you're in, the second persists for every window after it.

bash
echo 'export PATH="$HOME/.dotnet/tools:$PATH"' >> ~/.zprofilesource ~/.zprofile

Or just open a new terminal — the profile line applies from then on.

bash
echo 'export PATH="$HOME/.dotnet/tools:$PATH"' >> ~/.bashrcsource ~/.bashrc

Assumes bash; on zsh, use ~/.zprofile as shown in the macOS tab.

*2 · You just installed it and the same window still can't find it.* Even with PATH persisted correctly, the terminal you ran the install in was launched before the change. Run the session-fix line above (Windows) or source your profile (macOS / Linux) — or simply open a new terminal.

3 · dotnet itself is not found. The machine doesn't have the .NET SDK — go back to Install the .NET SDK first, then re-run the install.

Once kanject resolves, kanject doctor takes over the diagnosis: it raises KANCLI018 whenever the global-tools directory isn't on PATH. It can only tell you that once the command itself runs — which is why this page front-loads the PATH fix.

Upgrade

Once kanject is on your PATH, the ergonomic upgrade path is its own command — it checks both the CLI and the template pack and applies them together:

bash
kanject update           # interactive; checks CLI + templateskanject update --yes     # non-interactive (CI)

If you're on a build that predates kanject update, fall back to:

bash
dotnet tool update -g Kanject.Cli

Uninstall

bash
dotnet tool uninstall -g Kanject.Cli
Recap
  • No .NET on the machine? Install the SDK first — winget on Windows, brew on macOS, the dot.net install script on Linux — then kanject installs as a .NET global tool from public NuGet.
  • The #1 setup failure is PATH, not the install: add ~/.dotnet/tools (macOS / Linux) or %USERPROFILE%\.dotnet\tools (Windows), fix the current window too, then re-run kanject --version. kanject doctor flags it as KANCLI018.
  • On Windows, [Environment]:: must have no space before the ::, and persist by appending to the User PATH value — not $env:Path.
  • kanject update upgrades the CLI and template pack together; the fallback is dotnet tool update -g Kanject.Cli.
  • A clean kanject doctor (0 warn, 0 error) means you're ready for Quick Start.
Was this page helpful?