Closed
Description
When using the Versioning system with a Core 2.2 Preview project, the routing can't differentiate by version #'s if you use the 2.2 Compatibility Flag (it's not required that you leave Core 2.2, just set the compatibility flag to 2.1):
public void ConfigureServices(IServiceCollection services)
{
services.AddApiVersioning(opt =>
{
opt.DefaultApiVersion = new ApiVersion(1, 1);
opt.ReportApiVersions = true;
opt.AssumeDefaultVersionWhenUnspecified = true;
});
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1); // <--- Works
//.SetCompatibilityVersion(CompatibilityVersion.Version_2_2); // <--- Doesn't Work
}
I tried both the 2.1 version of the library and the 3.0-beta-1 and got same result.
My controller looks like this:
[Route("api/[controller]")]
[ApiController]
[ApiVersion("1.0")]
[ApiVersion("1.1")]
public class ValuesController : ControllerBase
{
// GET api/values
[HttpGet]
[MapToApiVersion("1.0")]
public ActionResult<string> Get() => "1.0";
[HttpGet]
public ActionResult<string> Get11() => "1.1";
}
Here is a minimal repro case for you to try: