Skip to content

Migrating from v0

v1 has breaking changes, so an existing v0 project needs a few updates before it runs. They are small, and they exist for a good reason: v1 removes nearly all of the backend configuration v0 required. This page covers what changed and how to upgrade.

In v0 you described your SPA to the back end by hand, in appsettings.json, and kept that description in sync with vite.config.ts. Two files held the same facts, and drift between them was the most common source of problems.

In v1 the Vite plugin emits manifest files describing each app, and the back end reads them. Your vite.config.ts becomes the single source of truth, and backend configuration collapses to one line:

appsettings.Development.json
{ "ViteDotNet": "ReactApp" }
AreaBefore (v0)Now
Backend configFull per-app settings (entrypoint, container id, port, framework) in appsettings.jsonJust the app directory name(s) under ViteDotNet
App identityConfigured explicitlyDerived from the SPA’s folder automatically
Dev/prod metadataBackend configmanifest.dev.json / manifest.prod.json in wwwroot

What that buys you: the entrypoint, container element id, dev-server port, and framework detection are no longer written by hand anywhere, so there is nothing left to keep in sync. Change your entrypoint in vite.config.ts and the back end follows on the next dev-server start or build. The dev server records whichever port it actually bound to, so ports can change freely. And adding a second SPA is just adding its folder name to a list — see Multiple SPAs.

The trade-off is that the values the back end used to read from your configuration are no longer read from there, which is what makes the upgrade a breaking one.

  1. Update both packages

    The manifests are the contract between TechGems.ViteDotNet (NuGet) and vite-dotnet (npm), so the two must move to v1 together. A v0 plugin emits no manifests for a v1 back end to read, and a v1 plugin’s manifests mean nothing to a v0 back end.

    The current releases are 1.0.0 on NuGet and 1.0.0 on npm. As prereleases the version has to be given explicitly (or --prerelease), otherwise NuGet keeps you on v0:

    dotnet add package TechGems.ViteDotNet --version 1.0.0
    cd ReactApp && npm install vite-dotnet@1.0.0
  2. Pass the entrypoint and container id to the plugin

    These are the values that used to live in your backend configuration. Register the plugin after your framework plugin — it uses enforce: 'post' and inspects the resolved plugin list to detect React:

    ReactApp/vite.config.ts
    export default defineConfig({
    plugins: [
    react(),
    ViteDotNetPlugin('src/main.tsx', 'root'), // entrypoint, container element id
    ],
    })

    See ViteDotNetPlugin for the full reference.

  3. Simplify your backend configuration

    Replace the per-app configuration object with just the directory name(s). A v0-style object isn’t migrated — it is ignored, and the integration behaves as if nothing were configured:

    appsettings.Development.json
    { "ViteDotNet": "ReactApp" }
    { "ViteDotNet": [ "ReactApp", "SvelteApp" ] }

    See Backend Configuration.

  4. Confirm the tag helpers

    They are <dev-vite-scripts> and <prod-vite-scripts>, selected by app directory name via app-name (optional when only one app is configured):

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

    Passing an IntegrationConfig object directly to a tag helper in a view is no longer supported — the back end only needs the app’s location now.

  5. Rebuild

    Run the dev server (npm run dev) or a production build (npm run build) so the plugin writes the new manifests into wwwroot; the back end reads them from there. Delete any stale build output from the old layout first so old assets don’t linger.

The symptoms are quiet rather than loud, because the back end isn’t misconfigured so much as unconfigured — it stopped reading the settings you wrote:

SymptomCause
The page shows “Vite Dev Server Not Found” even though the dev server is runningNo manifest.dev.json — the plugin is registered without its arguments, or the dev server hasn’t been restarted since the upgrade.
The page shows “Production Bundle not found”No manifest.prod.json — the app hasn’t been rebuilt since the upgrade, or the configured directory name doesn’t match the folder in wwwroot.
The tag helper throws when renderingNothing registered: the ViteDotNet section still holds a v0 config object, so no app directories were found.
Your entrypoint, container id, or port changes have no effectThose values now come from the manifests, not appsettings.json. Change them in vite.config.ts and re-run.

In each case the fix has the same shape: make sure the plugin has its arguments, the config holds the directory name, and the app has been run or built once so the manifests exist.