I already added the package of Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer, but I'm still getting this error. Is anyone have an idea on how to resolve this issue?Thank you in advance.
Reference: https://www.meziantou.net/versioning-an-asp-net-core-api.htm#integration-with-ope
You haven't said which versions or runtimes you are targeting. I'm going to assume that your project is .NET Core 3.1 or newer and the language is C#. The ApiVersionDesription
class is defined in Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.dll. The following are required to resolve this error message:
using Microsoft.AspNetCore.Mvc.ApiExplorer;
You said you've already done #1 so I presume the only issue is #2. If you did not add the reference using tooling, it's worth double-checking that the NuGet package is properly referenced and the containing assembly was also added as a reference.
You also did not mention what your end goal was. 99% of the scenarios that use the API Explorer extensions for API Versioning want to wire up Swashbuckle or some other Open API/Swagger document generator. I would consider reviewing the official API Versioning Swagger Example for ASP.NET Core and cross-reference it with your configuration. It is a working end-to-end solution and should help reveal the step or steps that you're missing.
UPDATE: If you're using ASP.NET API Versioning >= 6.0.0 then the correct:
Asp.Versioning.ApiExplorer