Skip to content

Repository files navigation

Setting up an ASP.NET Core API Project

Step 1: Create a New ASP.NET Core API Project

Create a new ASP.NET Core API Project in Visual Studio.

Step 2: Copy Required Files and Folders

Copy the following folders and files to the root directory of your project:

  • wwwroot
  • Controllers
  • Program.cs

Step 3: Update .csproj File

Add the following line to your .csproj file within PropertyGroup to enable XML documentation generation :

<GenerateDocumentationFile>true</GenerateDocumentationFile>

Step 4: Uncomment XML Comments Line in Program.cs

Uncomment the following line in Program.cs to include XML comments for Swagger:

options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));

Step 5: Install Required NuGet Packages

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

About

Minimal APIs provide built-in support for generating information about endpoints in an app via the Microsoft.AspNetCore.OpenApi package. Exposing the generated OpenAPI definition via a visual UI requires a third-party package.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages