Setting Up Your First ASP.NET Core Web API Project

Advanced Updated June 17, 2025

πŸ“¦ Setting Up Your First ASP.NET Core Web API Project

Let’s walk through the process of scaffolding and configuring a basic API.

πŸ› οΈ Prerequisites

  • .NET 8 SDK
  • IDE (Visual Studio 2022+, VS Code, or Rider)
  • Command-line terminal

βœ… Creating the Project

Run the following command to create a new Web API project:

dotnet new webapi -n ProductCatalogApi
cd ProductCatalogApi

This scaffolds a minimal API project with basic controller setup, dependency injection, and OpenAPI (Swagger) enabled.

πŸ“ Project Structure Overview

ProductCatalogApi/
β”‚
β”œβ”€β”€ Controllers/
β”‚   └── WeatherForecastController.cs
β”œβ”€β”€ Program.cs
β”œβ”€β”€ appsettings.json
└── ProductCatalogApi.csproj