.NET Core 3.0: Razor views don't automatically recompile on change
In this article i will provide the solution how to recompile asp core 3.0 application and show the changes on browser when we change something in Razor (views) while debug mode .
Applications that require runtime compilation or re-compilation of Razor files should:
- Add a reference to the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation package. It'll be available as part of the 3.0.0-preview3 release.
- Update the application's ConfigureServices to include a call to AddMvcRazorRuntimeCompilation:
public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().AddRazorRuntimeCompilation(); } }
Comments
Post a Comment