c#
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
I was defined as above, but I am getting an error to below code.

Is Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer referenced in your project? It looks like this reference could not be solved because this package is missing.
Spot on @Discjoggy.
You'll want to make sure you've included the packages:
I hope that helps.
Is
Microsoft.AspNetCore.Mvc.Versioning.ApiExplorerreferenced in your project? It looks like this reference could not be solved because this package is missing.
The problem was solved when I include Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer reference. Thank you everyone.
Most helpful comment
Spot on @Discjoggy.
You'll want to make sure you've included the packages:
I hope that helps.