繁体   English   中英

.net 6.0:如何在 .net 6.0 中生成 Swagger.json 文件?

[英].net 6.0 : How to generate Swagger.json file on build in .net 6.0?

我想在构建时生成 Swagger.Json 文件并在 API 网关中使用它来配置端点。

我已尝试执行以下步骤,但它不起作用。

创建工具清单:

dotnet new tool-manifest

安装Swashbuckle CLI工具,添加到本地manifest文件中:但是这一步失败

dotnet tool install --version 6.4.0 Swashbuckle.AspNetCore.Cli

错误:

 NU1202: Package Swashbuckle.AspNetCore.Cli 6.4.0 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package Swashbuckle.AspNetCore.Cli 6.4.0 supports:
  - net5.0 (.NETCoreApp,Version=v5.0) / any
  - net6.0 (.NETCoreApp,Version=v6.0) / any
  - netcoreapp2.1 (.NETCoreApp,Version=v2.1) / any
  - netcoreapp3.0 (.NETCoreApp,Version=v3.0) / any
NU1212: Invalid project-package combination for Swashbuckle.AspNetCore.Cli 6.4.0. DotnetToolReference project style can only contain references of the DotnetTool type 
NU1212: Invalid project-package combination for Swashbuckle.AspNetCore.Cli 6.4.0. DotnetToolReference project style can only contain references of the DotnetTool type 
Package 'Swashbuckle.AspNetCore.Cli 6.4.0' has a package type 'DotnetTool' that is not supported by project 'WebApi'.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM