Create a new ASP.NET Core API Project in Visual Studio.
Copy the following folders and files to the root directory of your project:
- wwwroot
- Controllers
- Program.cs
Add the following line to your .csproj file within PropertyGroup to enable XML documentation generation :
<GenerateDocumentationFile>true</GenerateDocumentationFile>Uncomment the following line in Program.cs to include XML comments for Swagger:
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));Open Tools -> NuGet Package Manager -> Package Manager Console in Visual Studio and run the following commands:
Install-Package Microsoft.AspNetCore.OpenApi
Install-Package Microsoft.Extensions.Configuration
Install-Package Microsoft.Extensions.Configuration.Json
Install-Package Microsoft.VisualStudio.Azure.Containers.Tools.Targets
Install-Package Swashbuckle.AspNetCore
Install-Package Swashbuckle.AspNetCore.Annotations