AspNetCore.Docs/aspnetcore/mvc/views/view-compilation.md

1.0 KiB

title author description keywords ms.author manager ms.date ms.topic ms.assetid ms.technology ms.prod uid
Razor view compilation and precompilation rick-anderson View compilation and precompilation in ASP.NET Core ASP.NET Core,Razor view compilation, Razor pre-compilation, Razor precompilation riande wpickett 5/24/2017 article ab4705b7-1638-1638-bc97-ea7f292fe92a aspnet asp.net-core mvc/views/view-compilation

Razor view compilation and precompilation in ASP.NET Core

By Rick Anderson

Razor views are compiled at runtime when the view is invoked. ASP.NET Core 1.1.0 and higher can optionally compile Razor views and deploy them with the app (precompilation). To deploy precompiled views, set MvcRazorCompileOnPublish to true and include a package reference to Microsoft.AspNetCore.Mvc.Razor.ViewCompilation. The following .csproj sample highlights these settings:

[!code-htmlMain]