As far as I know I've always been able to update cshtml files and
immediately see changes (upon refreshing browser) without having to
stop my project.
Yes.Before asp.net core 3.0,you could do it by default.After asp.net core 3.0,you could install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
NuGet package to enable runtime compilation.
1.Install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
NuGet package.
2.Update the project's Startup.ConfigureServices
method to include a call to AddRazorRuntimeCompilation
:
services.AddControllersWithViews().AddRazorRuntimeCompilation();
Reference:
https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-5.0&tabs=visual-studio#enable-runtime-compilation-in-an-existing-project
Update:
From asp.net core 3.1,you could select the Enable Razor runtime compilation checkbox in the Create a new ASP.NET Core web application dialog:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…