I am learning ASP.NET Core and encounter with the following compiler error CS1061 on AddVersionedApiExplorer
:
.
I am using the following at the beginning of my code:
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Asp.Versioning;
using Asp.Versioning.ApiExplorer;
using Microsoft.OpenApi.Models;
I have also installed
Asp.Versioning.Mvc
Asp.Versioning.Mvc.ApiExplorer,
However, I still can't solve the error.
Can anyone help with this?
Thanks,
Phil
According to this github issue, the usage of the ApiExplorer is like below:
builder.Services.AddApiVersioning( ).AddApiExplorer(options => {
options.GroupNameFormat = "json";
options.SubstituteApiVersionInUrl = true;
});