.NET Core 3.0: Razor views don’t automatically recompile on change

For ASP.NET Core 3 release version:



It can also be enabled conditionally only for local development, quoted from the link:

Runtime compilation can be enabled such that it’s only available for
local development. Conditionally enabling in this manner ensures that
the published output:

Uses compiled views.
Is smaller in size.
Doesn’t enable file watchers
in production.

   public Startup(IConfiguration configuration, IWebHostEnvironment env)
        Configuration = configuration;
        Env = env;

    public IWebHostEnvironment Env { get; set; }
    public IConfiguration Configuration { get; }

    public void ConfigureServices(IServiceCollection services)
        IMvcBuilder builder = services.AddRazorPages();

            if (Env.IsDevelopment())

Leave a Comment