domaindrivendev / Swashbuckle.AspNetCore

Swagger tools for documenting API's built on ASP.NET Core
MIT License
5.16k stars 1.29k forks source link

Add msbuild extension #1313

Open daniel-white opened 4 years ago

daniel-white commented 4 years ago

It would be great if there was an msbuild extension that worked like the CLI global tool. An AfterBuild target that generates the document to a file would be awesome.

Coverlet is a great example: they have a CLI and an MSBuild extension

https://github.com/tonerdo/coverlet

domaindrivendev commented 4 years ago

You can wire this up pretty easily with a simple Exec target. See the following csproj from one of our sample apps for inspiration:

https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/master/test/WebSites/CliExample/CliExample.csproj#L23

daniel-white commented 4 years ago

Sure, but this would make it hard to version. Having it as a NuGet dependency/msbuild tool, I don't have to have the correct version installed separately on devs machines or on the CI machine.

daniel-white commented 4 years ago

@domaindrivendev So I'm at this point: NSwag also has a MSBuild dependency that works with VS for Mac.

https://github.com/RicoSuter/NSwag/wiki/NSwag.MSBuild

<DotNetCliToolReference> are broken in VS for Mac, so I can't use them, but the nswag msbuild works great.

I'd love to stay with swashbuckle due to the extension for fluent validation.