Enabling view refresh after .CSHTML changes for new projects in Visual Studio

Since .NET Core 3.0 your views in MVC won’t refresh after you change your .CSHTML markup. You can enable this for existing projects by installing Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation and setting AddRazorRuntimeCompilation() in your Startup.cs -> ConfigureServices method…

… and …

for new projects you can check the ‘Enable Razor runtime compilation’ checkbox for 3.1 projects onwards when creating the projects.

Enable view refresh for new projects in Visual Studio

Leave a Reply

Your email address will not be published.