Installation

Install Inertia.Net, the optional MVC, FastEndpoints or SignalR package, and the testing helpers.

On this page

Inertia.Net is split into small packages. Install the core package and one optional backend integration.

PackageInstall when
Inertia.Netalways. The core adapter, Minimal API support, Vite, SSR, state store and antiforgery
Inertia.Net.Mvcyou use MVC controllers: ModelState filter, Razor root view and tag helpers
Inertia.Net.FastEndpointsyou use FastEndpoints: Send extensions, validation pre-processor and Precognition
Inertia.Net.Live.SignalRyou deliver live props over SignalR: hub, channel authorization and broadcaster
Inertia.Net.EntityFrameworkCoreyou page EF Core queries with numbered or cursor pagination
Inertia.Net.Testingin your test project: fluent assertions over Inertia responses
Inertia.Net.Templatesdotnet new install Inertia.Net.Templates: start a complete app
Text
dotnet add package Inertia.Net --version 1.7.0
dotnet add package Inertia.Net.Mvc --version 1.7.0            # MVC only
dotnet add package Inertia.Net.FastEndpoints --version 1.7.0  # FastEndpoints only
dotnet add package Inertia.Net.EntityFrameworkCore --version 1.7.0 # EF Core pagination
dotnet add package Inertia.Net.Testing --version 1.7.0        # test projects
dotnet add package Inertia.Net.Live.SignalR --version 1.7.0   # live props over SignalR

Use the same version for every Inertia.Net package. The package version and the Inertia.js protocol version are separate numbers: Inertia.Net 1.7.0 implements Inertia.js v3.

Requirements

  • .NET 10 SDK and an Microsoft.NET.Sdk.Web project.
  • JavaScript frontend build tools with npm, Bun, pnpm or Yarn. Managed SSR requires Node.js or Bun at runtime.
  • An Inertia.js v3 client: @inertiajs/react, @inertiajs/vue3 or @inertiajs/svelte.

Start from the template

Text
dotnet new install Inertia.Net.Templates::1.7.0
dotnet new inertia -n MyApp --framework react
cd MyApp

Choose --framework vue or --framework svelte for another client. The template includes working pages, a Todos form, validation, flash messages, CSRF protection and Vite configuration.

Install dependencies, then start Vite using the package manager chosen for your app. All four are supported:

Package managerInstall dependenciesStart ViteBuild assets
npmnpm installnpm run devnpm run build
Bunbun installbun run devbun run build
pnpmpnpm installpnpm run devpnpm run build
Yarnyarn installyarn run devyarn run build

Keep Vite running and start ASP.NET Core in another terminal with dotnet watch. For production, run your row's build command, then dotnet publish -c Release. Keep the lockfile for the package manager you choose.

Namespace and global usings

The namespace is Inertia.Net and the static factory class is Inertia.Net.Inertia. C# resolves a leading Inertia to the namespace, so Inertia.Render(...) does not compile outside the Inertia.Net namespace.

The package's buildTransitive props file adds both global usings when <ImplicitUsings>enable</ImplicitUsings> is set, which is the default in new projects:

Text
global using Inertia.Net;
global using static Inertia.Net.Inertia;

Write Render(...), Defer(...), Once(...), Back() and Location(...) unqualified.

Opting out

Set <InertiaNetImplicitUsings>false</InertiaNetImplicitUsings> and add using static Inertia.Net.Inertia; yourself, or call Inertia.Net.Inertia.Render(...). HttpContext.Inertia() is an extension method and works as written.

Next steps