Skip to main content

Installation

Install the template

BlazorNative is published on nuget.org as a stable release, so nothing here needs --prerelease. Installing the template is one command:

dotnet new install BlazorNative.Templates

There is deliberately no version on that command — the current version lives on nuget.org, which is the only place that knows it. To pin a specific one, append ::<version> using a version listed on nuget.org (for example ::x.y.z).

Then go to Quick start to create and run an app.

Consuming the packages directly

If you are wiring BlazorNative into an existing project rather than using the template, a dotnet new app references only three packages directly. Everything else arrives transitively through BlazorNative.Runtime, so you do not add it yourself:

PackageWhat it isHow you get it
BlazorNative.RuntimeNativeAOT composition root + the C-ABI export surfacedirect
BlazorNative.Componentsthe Bn* component librarydirect
BlazorNative.Analyzersthe compile-time analyzersdirect
BlazorNative.Rendererthe headless renderer + patch modeltransitive (via Runtime)
BlazorNative.Corethe IMobileBridge contract + bridge implementationstransitive (via Runtime)
BlazorNative.HttpHttpClient over the host fetch bridgetransitive (via Runtime)
BlazorNative.Devicedevice-capability façades (geolocation, notifications, biometrics, secure storage, camera)transitive (via Runtime)

So the whole requirement is three commands — no version needed, nuget.org supplies the current one:

dotnet add package BlazorNative.Runtime
dotnet add package BlazorNative.Components
dotnet add package BlazorNative.Analyzers

Renderer, Core, Http and Device then resolve automatically as dependencies of Runtime; you can confirm the full closure with dotnet list package --include-transitive.

Building from source instead

Prefer to build the template locally — to hack on it, or to try an unreleased change? Clone and pack it, then install from the local feed:

git clone https://github.com/MarcelRoozekrans/BlazorNative.git
cd BlazorNative
dotnet pack templates/BlazorNative.Templates -c Release -o ./artifacts/packages
dotnet new install ./artifacts/packages/BlazorNative.Templates.*.nupkg

Prerequisites

ToolPurposeNeeded for
.NET SDK 10Build + the NativeAOT publishEverything
Temurin JDKGradle / the Kotlin shellAndroid
Android SDK + NDKThe bionic cross-compile, and the emulatorAndroid
An AVD or a deviceActually running itAndroid
macOS + XcodeThe Swift/UIKit shelliOS (simulator only)

The exact SDK band and NDK revision are pinned by the repository, not by this page. A generated app carries a global.json that pins the .NET SDK feature band the ILC host relies on, and the Android shim names its NDK revision. Those pins are the truth; a version number typed here would be a copy that rots the day either moves. If you want the numbers, read global.json and build/BionicNativeAot.targets in the repository — or just run the setup script below, which installs and verifies all of them for you.

Environment setup the tools assume

Installing the SDKs is not quite enough — three environment steps trip up a fresh machine:

  • win-x64 NativeAOT link: the native link step needs the Visual Studio C++ toolchain, which it locates with vswhere. Run your builds from a Developer Command Prompt for Visual Studio, or make sure the VS Installer directory is on PATH so vswhere is reachable.
  • Gradle / Android: point JAVA_HOME at a JDK 21 (not an old JRE) — Gradle reads JAVA_HOME, and an older or JRE-only Java fails the shell build.
  • bionic / Android publish: set ANDROID_NDK_ROOT to your installed NDK (for example $ANDROID_HOME/ndk/<version>) so the bionic cross-compile can find it.

Windows: one script does the whole thing

The repository ships a prerequisite installer that pins every tool to the version the build expects:

powershell -ExecutionPolicy Bypass -File setup.ps1

Verify

dotnet new list blazornative

If the template is installed, that lists it. If it does not, re-run the install command at the top of this page before assuming your machine is at fault.

Next: Quick start.