我正在测试包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"发布于 2019-10-19 19:53:38
问题解决了。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文件。
发布于 2019-10-19 11:40:23
--首先,在项目属性中,选中标有"Generate“的框。

您可能还想要取消警告1591,这将给出关于任何方法、类或字段的警告,这些方法、类或字段没有三重斜杠注释。

发布于 2020-11-28 16:16:10
将以下行添加到.csproj文件中:
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>https://stackoverflow.com/questions/58462678
复制相似问题