Hot Reload not working on upgraded (.Net 5 -> .Net 6) projects

Viewed 1800

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

On the same machine, same version Visual Studio, a project upgraded from 5 to 6 (including all nuget packages).... no hot reload. The button is active, 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 re-targeting .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.

Has anyone had success upgrading from .Net 5 to .Net 6 and getting Hot Reload to work? Is there some critical step I'm missing?

2 Answers

It might sound couterintuitive, but in Startup.cs change services.AddControllersWithViews().AddRazorRuntimeCompilation(); to services.AddControllersWithViews(); and remove the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet Package.

Startup.cs change

Related