Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The MVC compatibility version APIs, such as CompatibilityVersion and SetCompatibilityVersion, are removed in ASP.NET Core 11. These APIs were no-ops since ASP.NET Core 3.0 and have been marked obsolete since ASP.NET Core 6.
Version introduced
.NET 11 Preview 7
Previous behavior
Previously, the compatibility version APIs existed and could be called, but they produced an obsoletion warning at build time and had no effect at runtime:
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Latest);
New behavior
Starting in ASP.NET Core 11, these APIs no longer exist. Code that calls them fails to compile, and existing binaries that reference them fail at runtime with a MissingMethodException or TypeLoadException.
Type of breaking change
This change can affect source compatibility and binary compatibility.
Reason for change
The APIs have been marked obsolete since ASP.NET Core 6 and did nothing since ASP.NET Core 3.0, so they served no value. For more information, see dotnet/aspnetcore#67077.
Recommended action
Remove any usages of these APIs. For example, change the following code:
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Latest);
To:
services.AddMvc();
Affected APIs
Microsoft.Extensions.DependencyInjection.MvcCoreMvcBuilderExtensions.SetCompatibilityVersionMicrosoft.Extensions.DependencyInjection.MvcCoreMvcCoreBuilderExtensions.SetCompatibilityVersionMicrosoft.AspNetCore.Mvc.Infrastructure.ConfigureCompatibilityOptions<TOptions>Microsoft.AspNetCore.Mvc.MvcCompatibilityOptionsMicrosoft.AspNetCore.Mvc.CompatibilityVersion
ASP.NET Core