Skip to content

Backend Configuration

The back end’s configuration has been reduced to a single thing: the directory name(s) of the integrated Vite app(s). Every other value the back end needs is read from the manifests the plugin emits into wwwroot.

Add the app folder name under the ViteDotNet key. It accepts either a single string or an array.

appsettings.Development.json
{
"ViteDotNet": "ReactApp"
}

The value(s) must match the SPA folder names — the same names the plugin derives from each app’s working directory, and the folders the manifests are written under in wwwroot.

Register the integration on the service collection in Program.cs. There are three overloads.

Reads the app directory name(s) from the ViteDotNet configuration section:

Program.cs
builder.Services.AddViteIntegration(builder.Configuration);

Bypasses configuration and registers one app directly:

Program.cs
builder.Services.AddViteIntegration("ReactApp");
Program.cs
builder.Services.AddViteIntegration(new[] { "ReactApp", "SvelteApp" });

The tag helpers live in the ViteDotNet assembly. Register them in _ViewImports.cshtml (in the Pages folder for Razor Pages, or Views for MVC):

Pages/_ViewImports.cshtml
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, ViteDotNet

This makes <dev-vite-scripts> and <prod-vite-scripts> available in your pages.

Compared with older versions, these values are no longer in your backend config — they come from the manifests instead:

  • The entrypoint (src/main.tsx)
  • The container element id (root)
  • The dev-server port
  • Whether the app is React

They live in vite.config.ts (the plugin’s arguments) and are emitted into the manifests at dev and build time. See How It Works and, if you’re upgrading, the Migrating from v0 guide.