Installation
Install Inertia.Net, the optional MVC, FastEndpoints or SignalR package, and the testing helpers.
Inertia.Net is split into small packages. Install the core package and one optional backend integration.
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.Webproject. - 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/vue3or@inertiajs/svelte.
Start from the template
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:
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:
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.