Search code examples
asp.net-coreasp.net-core-mvc

ASP.NET Core "Start without debugging" won't make changes


I'm new to ASP.NET Core, I'm using 6.0, but my "Start without debugging" is in trouble somehow.

I know that when I use the "ctrl F5", the web starts and I can make changes while it is running, but when I tried to change the cshtml files, it just won't change what is on the web, even when I refresh the web.

Changes only happen when I close and rerun it or after I edit the files, save, and press "ctrl alt enter" in Visual Studio.

I tried installing Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation and added builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation(); to the Program.cs but it seems like it doesn't help


Solution

  • I have tested ASP.NET Core and installed Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation ,it works Try it :

    1. Install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package.
    2. In Program.cs, add"builder.Services.AddRazorPages().AddRazorRuntimeCompilation();"