Setting Up Your First ASP.NET Core Web API Project
π¦ 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