ApiExplorer migration #972
-
I've migrated a project from .NET 5 to .NET 7, and also I've tried to migrate from Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer 5.0.0 to Asp.Versioning.Mvc.ApiExplorer 7.0.0, but I cannot find an extension method for AddVersionedApiExplorer accepting a first argument of type IServiceCollection. For example, the code below works with the old package but it doesn't work with the new package. builder.Services.AddVersionedApiExplorer(setup => setup.GroupNameFormat = "'v'VVV"); How can I solve this? Is it a breaking change or is it on the roadmap? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Good question. There is now You have the correct package. The setup should now be: builder.Services.AddApiVersioning()
.AddApiExplorer(options => GroupNameFormat = "'v'VVV"); This configuration will implicitly imply: builder.Services.AddApiVersioning()
.AddMvc() // ← adds MVC Core with versioning support for controllers
.AddApiExplorer(options => GroupNameFormat = "'v'VVV"); With the introduction of Minimal APIs, |
Beta Was this translation helpful? Give feedback.
Good question. There is now
IApiVersioningBuilder
that all subsequent configurations and services hang off of. The idea was to centralize everything API Versioning via one builder. Previously, there were several different configuration paths.You have the correct package. The setup should now be:
This configuration will implicitly imply:
With the introduction of Minimal APIs,
AddApiVersioning()
…