Skip to main content

Napacitor CLI

The Napacitor CLI (@napacitor/cli) is the command-line tool for creating, building, and managing Napacitor apps. The native platform is a single .NET MAUI Blazor host project, so instead of per-platform commands (add ios, add android) there is one platform command: nap add maui.

Install​

Install the CLI as a dev dependency in your project:

npm install @napacitor/cli --save-dev

Run any command with npx nap <command>.

Commands​

CommandDescription
initInitialize a new app, writing napacitor.config.json
addGenerate the MAUI host project from the embedded template
assetsApply icons / splash screens / theme colors to the host (MAUI Resizetizer)
copyCopy the web build output into the host wwwroot
synccopy + regenerate napacitor.build.props (wires plugin C# projects)
openOpen the host project with the OS default handler
buildBuild the host project (dotnet build)
cleanClean host build artifacts (dotnet clean)
runBuild and run the app on a target device (dotnet build -t:Run)
listList installed @napacitor/* packages
helpPrint usage help

All commands accept an optional platform argument (maui) which can be omitted — Napacitor currently has a single native platform target.

Common options​

  • --target <windows|android|ios|maccatalyst> — target platform for build / clean / run. Defaults to windows on Windows and android elsewhere.
  • -c <Debug|Release> — build configuration for build / clean / run. Defaults to Debug.

Configuration​

The CLI reads and writes napacitor.config.json in the app root. See Configuring your app for the available options.

Learn about the full workflow in the Workflow guide.