To generate OpenApi.json on build from an ASP.NET 8 Minimal API, follow these steps:
-
In Visual Studio for Windows 17.7.0 or later, create a new
ASP.NET Core APIproject -
Follow these instructions to install
Swashbuckle.AspNetCore.Clias a local dotnet tool in your project -
Add these NuGet packages (or later versions) to the project:
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0-preview.4.23260.4" />