asp.net-coreblazorblazor-webassembly.net-6.0

Hot reload is not working on upgraded (.NET 5 -> .NET 6) projects


With a fresh install of Windows 11 (in case it matters) and a fresh install of the Visual Studio 2022 release (not preview), new Blazor WASM projects (the default template) hot reload works fine.

On the same machine, the same version Visual Studio, a project upgraded from 5 to 6 (including all NuGet packages).... no hot reload. The button is active, and you can click it. It flashes and looks like something should be happening, but the browser does not update at all.

I have checked that all projects are retargeting .NET 6. The application actually runs just fine.

I am not running with Debugging, as I understand that Debugging + WASM + Hot Reload does not work.

How can I upgrade from .NET 5 to .NET 6 and get Hot Reload to work? Is there some critical step I'm missing?


Solution

  • https://github.com/dotnet/aspnetcore/issues/28293

    in the startup file, it seems the middleware UseResponseCompression() breaks hot reload completely.

    This fixes it

    #if !DEBUG
                app.UseResponseCompression();
    #endif