Program.cs

noun

say it: “PROH-gram DOT SEE-ESS” /ˈproʊɡræm dɒt ˌsiː ˈɛs/

The file where an ASP.NET Core app is set up and started: its services, middleware and routes.

What is Program.cs?

Program.cs is where an ASP.NET Core app starts. It registers services, builds the app, sets up the request pipeline and maps endpoints, all in a few lines.

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOpenApi();

var app = builder.Build();
app.MapGet("/", () => "Hello from Recipe Box!");
app.Run();

In a sentence

  • “I registered the product repository in Program.cs.”

Level: Novice · More ASP.NET Core terms at this level

Updated