Hot reload

When running in the development mode, DotVVM watches markup files for changes, and recompiles them without the need to restart the web application process.

Additionally, there are DotVVM.HotReload.AspNetCore and DotVVM.HotReload.Owin packages that will inject a simple JavaScript in the page that will reload the page automatically while preserving the viewmodel state.

Thus, when working on your DotVVM pages, you can just run the DotVVM application once and edit the markup files in your IDE. When you save the file, the page loaded in the browser will reflect the changes immediately.

Configuration

When you create a DotVVM application, Hot reload is already configured. To add it manually, you need to perform the following steps:

  1. Install DotVVM.HotReload.AspNetCore NuGet package.

  2. In Program.cs (or Startup.cs file), add the following line after the call to UseDotVVM:

    app.UseDotvvmHotReload();
    
  3. In the ConfigureServices in DotvvmStartup.cs, add the following line:

    public void ConfigureServices(IDotvvmServiceCollection services)
    {
        services.AddHotReload();
        ...
    }
    
  4. Ensure you run the application with ASPNETCORE_ENVIRONMENT=Development. You can check this in Properties/launchSettings.json, or you can see it in the console output of the application. See the Debug mode section for more details.

See also