CompatibilityVersion Enum

Definition

Specifies the version compatibility of runtime behaviors configured by MvcOptions.

public enum class CompatibilityVersion
public enum CompatibilityVersion
type CompatibilityVersion = 
Public Enum CompatibilityVersion
Inheritance
CompatibilityVersion

Fields

Latest 2147483647

Sets the default value of settings on MvcOptions to match the latest release. Use this value with care, upgrading minor versions will cause breaking changes when using Latest.

Version_2_0 0

Sets the default value of settings on MvcOptions to match the behavior of ASP.NET Core MVC 2.0.

Version_2_1 1

Sets the default value of settings on MvcOptions to match the behavior of ASP.NET Core MVC 2.1.

Version_2_2 2

Sets the default value of settings on MvcOptions to match the behavior of ASP.NET Core MVC 2.2.

Version_3_0 3

Sets the default value of settings on MvcOptions and other Options types to match the behavior of ASP.NET Core MVC 3.0.

Remarks

The best way to set a compatibility version is by using SetCompatibilityVersion(IMvcBuilder, CompatibilityVersion) or SetCompatibilityVersion(IMvcCoreBuilder, CompatibilityVersion) in your application's ConfigureServices method. Setting the compatibility version using IMvcBuilder:


       public class Startup
       {
           ...
      
           public void ConfigureServices(IServiceCollection services)
           {
               services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
           }
      
           ...
       }

Setting compatibility version to a specific version will change the default values of various settings to match a particular minor release of ASP.NET Core MVC.

Applies to