In ASP.NET Core 3.0 and higher, RazorViewEngineOptions.AllowRecompilingViewsOnFileChange
is not available.
Surprised that refreshing a view while the app is running did not work, I discovered the following solution:
-
Add Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package to the
project -
Add the following in
Startup.cs
:services.AddControllersWithViews().AddRazorRuntimeCompilation();
Here’s the full explanation for the curious.