TechGems.ViteDotNet 1.0.1

dotnet add package TechGems.ViteDotNet --version 1.0.1
                    
NuGet\Install-Package TechGems.ViteDotNet -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TechGems.ViteDotNet" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TechGems.ViteDotNet" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="TechGems.ViteDotNet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TechGems.ViteDotNet --version 1.0.1
                    
#r "nuget: TechGems.ViteDotNet, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TechGems.ViteDotNet@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TechGems.ViteDotNet&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=TechGems.ViteDotNet&version=1.0.1
                    
Install as a Cake Tool

Vite.NET

Integrate Vite SPAs into ASP.NET Core Razor Pages and MVC — one build tool, shared authentication, and micro-frontends without leaving .NET.

📖 Full documentation: vite-dotnet.techgems.net

Vite.NET bridges a Vite-powered front end (React, Svelte, Vue, Solid) and an ASP.NET Core back end. Your SPA lives inside your .NET app, so it inherits your authentication, layouts, and static-file pipeline — while Vite gives you a fast dev server, hot module replacement, and optimized production bundles.

Upgrading from v0? v1 has breaking changes, but the upgrade is short: it removes nearly all backend configuration, since the Vite plugin now emits manifests describing each app. A handful of edits, covered step by step in Migrating from v0.

Why Vite.NET

  • One build tool — Vite compiles your front end; ASP.NET Core serves it. No second server, no separate deployment.
  • Zero-duplication config — the Vite plugin emits manifests describing each app, so the back end only needs the app's folder name. Everything else is generated.
  • Shared authentication — because the SPA is served by your .NET app, it sits behind the same auth and cookies as the rest of your site.
  • Micro-frontends — embed one SPA or many, each mounted into its own Razor page, all inside a single ASP.NET Core host.

How it fits together

An integration has three moving parts:

  1. A Vite plugin (vite-dotnet) added to your SPA's vite.config.ts. It configures the build output and emits a small JSON manifest describing the app.
  2. This NuGet package (TechGems.ViteDotNet) registered in your ASP.NET Core app. It reads those manifests and exposes the tag helpers.
  3. Two tag helpers — <dev-vite-scripts> and <prod-vite-scripts> — that render the correct <script>/<link> tags into a Razor page for development or production.

Quick start

Register the integration in Program.cs:

builder.Services.AddViteIntegration(builder.Configuration);

Add the tag helpers in Pages/_ViewImports.cshtml:

@addTagHelper *, ViteDotNet

Tell the back end your SPA folder name in appsettings.json:

{
  "ViteDotNet": "ReactApp"
}

Add the plugin in ReactApp/vite.config.ts:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import ViteDotNetPlugin from 'vite-dotnet'

export default defineConfig({
  plugins: [react(), ViteDotNetPlugin('src/main.tsx', 'root')],
})

Render the SPA in a Razor page — <dev-vite-scripts> in development, <prod-vite-scripts> in production:

<dev-vite-scripts app-name="ReactApp" />

With a single app configured you can omit app-name entirely. See the full Quick Start for the complete walkthrough, including the production build.

Learn more

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 146 9/9/2026
1.0.0 157 8/18/2026
1.0.0-beta 140 8/17/2026
0.1.1 80,634 11/25/2023 0.1.1 is deprecated.
0.1.0-beta 582 1/6/2023

- Update to TechGems.StaticComponents 1.4.0