Skip to content

AspNetCoreToOpenApiCommand

Marko Lahma edited this page Apr 18, 2025 · 2 revisions

Either provide a Project or Assembly with an ASP.NET Core Startup class.

We recommend to not use any settings beside assembly/project settings and specify one of the documents which are added with AddOpenApiDocument(document => document.DocumentName = "v1") or AddSwaggerDocument() and configure the document in your web app code.

Then generate the document via CLI:

nswag aspnetcore2openapi /project:MyAspNetCoreApp /documentName:v1 /output:swagger.json

The command is based on the AspNetCoreOpenApiDocumentGenerator.

Important for .NET Core: Assembly loading.