ASP.NET Core3.0 in the run-time compiler

Compile and run time

Razor by running the file when compiling supplementary generating compiled. When the content .cshtml file is changed, ASP.NET Core MVC Razor file will be recompiled.

Razor by running the file when compiling supplementary generating compiled. RazorViewEngineOptions  AllowRecompilingViewsOnFileChange  Gets or sets a value that determines whether to re-compile time when the file on disk changes and updates Razor file (Razor view and Razor Pages).

For the following items, the default value  true:

  • The version compatibility settings for  Version_2_1  or earlier
  • If the application compatibility version set  Version_2_2  or higher, and application development environments located  IsDevelopment  in. In other words, unless explicitly set  AllowRecompilingViewsOnFileChange , or Razor file is not recompiled in a non-development environment.

About setting compatibility version of the application guidance and examples, see the  compatibility version of ASP.NET Core MVC .

Use  Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation runtime compiler package is enabled. To enable run-time compiler, the application must:

  • Installation  Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation  the NuGet package.

  • The project  Startup.ConfigureServices method updated to include on the  AddRazorRuntimeCompilation call:

    services
        .AddControllersWithViews()
        .AddRazorRuntimeCompilation();
    
  •  

Guess you like

Origin www.cnblogs.com/yanglang/p/11877082.html