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:
| Package | What it is | How you get it |
|---|---|---|
BlazorNative.Runtime | NativeAOT composition root + the C-ABI export surface | direct |
BlazorNative.Components | the Bn* component library | direct |
BlazorNative.Analyzers | the compile-time analyzers | direct |
BlazorNative.Renderer | the headless renderer + patch model | transitive (via Runtime) |
BlazorNative.Core | the IMobileBridge contract, the capability result types, and the DevHostBridge mock | transitive (via Runtime) |
BlazorNative.Http | HttpClient over the host fetch bridge | transitive (via Runtime) |
BlazorNative.Device | device-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.
One more package exists, and it belongs in your test project, never the app:
BlazorNative.Testing mounts a page in a unit test and hands you the widget tree it rendered.
See Testing a page.
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
| Tool | Purpose | Needed for |
|---|---|---|
| .NET SDK 10 | Build + the NativeAOT publish | Everything |
| Temurin JDK | Gradle / the Kotlin shell | Android |
| Android SDK + NDK | The bionic cross-compile, and the emulator | Android |
| An AVD or a device | Actually running it | Android |
| macOS + Xcode | The Swift/UIKit shell | iOS — the simulator, or a device with your own signing (iOS shell) |
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 onPATHsovswhereis reachable. - Gradle / Android: point
JAVA_HOMEat a full JDK — the one the setup script installs, not an old JRE. Gradle readsJAVA_HOME, and an older or JRE-only Java fails the shell build. - bionic / Android publish: set
ANDROID_NDK_ROOTto 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
Linux and macOS: setup.sh
The same installer for Linux and macOS. It needs no root: the .NET SDK, PowerShell 7, the JDK
and the Android SDK all go under your home directory, and your shell profile is left alone. It
prints the export lines to add yourself:
./setup.sh # everything
./setup.sh --skip-android # .NET only
The win-x64 JVM dev loop is Windows-only. Everything else works on Linux and macOS: the .NET
suite, and the linux-bionic publishes that produce the Android .so. On an arm64 Linux host
the bionic publish does not run, because the NDK ships no linux-aarch64 toolchain.
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.