我正在测试软件包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
问题已解决。 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文件。