如何使用 Asp.Versioning.Mvc.ApiExplorer 配置 swagger 的版本控制

Out*_*uch 1 .net-core asp.net-core-webapi

AddVersionedApiExplorer我在dotnet core 6版本中找不到这个方法来配置swagger Asp.Versioning.Mvc.ApiExplorer。使用此版本控制库配置 swagger 的新方法是什么?

小智 6

似乎该方法已被删除,但没有任何说明原因。

在 github 中找到了这个评论,这似乎是处理它的新方法。

        services
            .AddApiVersioning()
            .AddApiExplorer();
Run Code Online (Sandbox Code Playgroud)

https://github.com/OData/AspNetCoreOData/issues/480#issuecomment-1094107292