Swashbuckle CLI无法找到XML文件

问题描述 投票:0回答:2

我正在测试软件包Swashbuckle.AspNetCore.Cli并在运行时遇到错误dotnet swagger "tofile" --output "swagger.json" ".\bin\Debug\netcoreapp2.1\SwaggerTest.Api.dll" v1

Unhandled Exception: System.IO.FileNotFoundException: Could not find file 'C:\Users\Rogier\.nuget\packages\swashbuckle.aspnetcore.cli\5.0.0-rc2\lib\netcoreapp2.0\SwaggerTest.Api.xml'.

当我将生成的xml从项目文件夹移到'C:\Users\Rogier\.nuget\packages\swashbuckle.aspnetcore.cli\5.0.0-rc2\lib\netcoreapp2.0\SwaggerTest.Api.xml'时,它可以正常工作,并且swagger.json的创建没有任何错误,但是当我删除文件时,xml丢失了。这是cli工具中的错误,导致XML复制不正确吗?

我正在使用:

  • "Swashbuckle.AspNetCore.Cli" Version="5.0.0-rc2"

  • "Swashbuckle.AspNetCore" Version="5.0.0-rc4"

  • "Swashbuckle.AspNetCore.Annotations" Version="5.0.0-rc4"

  • netcoreapp2.1

c# swagger swashbuckle
2个回答
1
投票

首先,在项目属性中,选中标记为“ Generate XML Documentation”的框。xml documentation file

[您可能还希望禁止显示警告1591,该警告现在将对没有三斜杠注释的任何方法,类或字段给出警告。

enter image description here


0
投票

问题已解决。 dotnet swagger "tofile" --output "swagger.json" ".\bin\Debug\netcoreapp2.1\SwaggerTest.Api.dll" v1必须更改为dotnet swagger "tofile" --output "swagger.json" "..\SwaggerTest\bin\Debug\netcoreapp2.1\SwaggerTest.Api.dll" v1。进行此更改后,将正确创建swagger.json文件。

© www.soinside.com 2019 - 2024. All rights reserved.