Warm tip: This article is reproduced from serverfault.com, please click

Swashbuckle CLI cannot find XML file

发布于 2019-10-19 10:22:05

I am testing the package Swashbuckle.AspNetCore.Cli and facing an error when running 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'.

When I move the generated xml from the project folder into 'C:\Users\Rogier\.nuget\packages\swashbuckle.aspnetcore.cli\5.0.0-rc2\lib\netcoreapp2.0\SwaggerTest.Api.xml' it works fine and swagger.json is created without any errors, but when I remove the file, the xml is missing. Is this a bug in the cli tool that the XML is not copied correctly?

I am using:

  • "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

Questioner
Rogier
Viewed
0
Rogier 2019-10-20 03:53:38

Problem solved. dotnet swagger "tofile" --output "swagger.json" ".\bin\Debug\netcoreapp2.1\SwaggerTest.Api.dll" v1 had to be changed into dotnet swagger "tofile" --output "swagger.json" "..\SwaggerTest\bin\Debug\netcoreapp2.1\SwaggerTest.Api.dll" v1. The swagger.json file is correctly created after this change.