Share via


RazorViewEngineOptions.AllowRecompilingViewsOnFileChange Property

Definition

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 true, MVC will use Watch(String) to watch for changes to Razor files in configured IFileProvider instances.

public:
 property bool AllowRecompilingViewsOnFileChange { bool get(); void set(bool value); };
public bool AllowRecompilingViewsOnFileChange { get; set; }
member this.AllowRecompilingViewsOnFileChange : bool with get, set
Public Property AllowRecompilingViewsOnFileChange As Boolean

Property Value

The default value is true if the version is Version_2_1 or earlier. If the version is later and EnvironmentName is Development, the default value is true. Otherwise, the default value is false.

Remarks

This property is associated with a compatibility switch and can provide a different behavior depending on the configured compatibility version for the application. See CompatibilityVersion for guidance and examples of setting the application's compatibility version.

Configuring the desired value of the compatibility switch by calling this property's setter will take precedence over the value implied by the application's CompatibilityVersion.

If the application's compatibility version is set to Version_2_1 or lower then this setting will have the value true unless explicitly configured.

If the application's compatibility version is set to Version_2_2 or higher then this setting will have the value false unless EnvironmentName is Development or the value is explicitly configured.

Applies to