Skip to content

Commit

Permalink
Document AllowRecompilingViewsOnFileChange (dotnet#10580)
Browse files Browse the repository at this point in the history
  • Loading branch information
guardrex authored Jan 24, 2019
1 parent 768c9d9 commit 95521a6
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion aspnetcore/mvc/views/view-compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Learn about the benefits of precompiling Razor files and how to acc
monikerRange: '>= aspnetcore-1.1'
ms.author: riande
ms.custom: mvc
ms.date: 05/17/2018
ms.date: 01/23/2019
uid: mvc/views/view-compilation
---
# Razor file compilation in ASP.NET Core
Expand Down Expand Up @@ -90,6 +90,25 @@ A *<project_name>.PrecompiledViews.dll* file, containing the compiled Razor file

::: moniker-end

## Recompile Razor files on change

The <xref:Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions> `AllowRecompilingViewsOnFileChange` gets or sets a value that determines if Razor files (Razor views and Razor Pages) are recompiled and updated if files change on disk.

When set to `true`, [IFileProvider.Watch](xref:Microsoft.Extensions.FileProviders.IFileProvider.Watch*) watches for changes to Razor files in configured <xref:Microsoft.Extensions.FileProviders.IFileProvider> instances.

The default value is `true` for:

* ASP.NET Core 2.1 or earlier apps.
* ASP.NET Core 2.2 or later apps in the Development environment.

`AllowRecompilingViewsOnFileChange` is associated with a compatibility switch and can provide different behavior depending on the configured compatibility version for the app. Configuring the app by setting `AllowRecompilingViewsOnFileChange` takes precedence over the value implied by the app's compatibility version.

If the app's compatibility version is set to <xref:Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_2_1> or earlier, `AllowRecompilingViewsOnFileChange` is set to `true` unless explicitly configured.

If the app's compatibility version is set to `CompatibilityVersion.Version_2_2` or later, `AllowRecompilingViewsOnFileChange` is set to `false` unless the environment is Development or the value is explicitly configured.

For guidance and examples of setting the app's compatibility version, see <xref:mvc/compatibility-version>.

## Additional resources

::: moniker range="= aspnetcore-1.1"
Expand Down

0 comments on commit 95521a6

Please sign in to comment.