With .NET 6, Microsoft introduced a modern, simplified hosting model that significantly changes how ASP.NET Core applications are bootstrapped. One major architectural shift was the merging of Startup.cs into Program.cs.
This change is not random — it solves real problems and streamlines application startup, configuration, and dependency injection.
1️⃣ Background: How It Worked Before (.NET 5 and Earlier)
Before .NET 6, an ASP.NET Core project contained two main startup files:
1. Program.cs
Configured the Host
Bootstrapped the application
Called
CreateHostBuilderLoaded Startup.cs
2. Startup.cs
Contained
ConfigureServices()→ Dependency InjectionContained
Configure()→ Middleware pipeline
This pattern worked well but introduced fragmentation, unnecessary files, and complexity for beginners.
2️⃣ Why Merge Startup.cs and Program.cs?
Microsoft aimed to evolve .NET into a more modern, minimal, and developer-friendly platform.
The merge solves multiple issues at once.
Reason 1: Simplify Application Bootstrapping (Minimal Hosting Model)
.NET 6 introduced the Minimal Hosting Model, where the entire app can be configured using a small, clean Program.cs file:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
var app = builder.Build();
app.MapControllers();
app.Run();
No more separate hosting classes or lengthy boilerplate code.
This makes .NET apps feel more like Node.js, Express, Python Flask, and Go.
Reason 2: Reduce Boilerplate & Improve Readability
Old structure included:
Program.cs
Startup.cs
CreateHostBuilder
UseStartup
WebHostDefaults
Beginners found this confusing.
The new unified Program.cs removes complexity and makes the project easier to read.
Before: 4–6 lines just to build a host.
After: 1 line:
var app = builder.Build();
Reason 3: Better Alignment with Modern Web Frameworks
Modern frameworks prefer single-file startup:
Node.js →
index.jsExpress →
server.jsFlask →
app.pySpring Boot →
Application.java
Merging Program.cs and Startup.cs aligns .NET with global developer expectations.
Reason 4: Flexibility — Everything can be configured in the order you want
In old Startup.cs:
Services configured in one file
Middleware configured in another
Host configured in Program.cs

Join the conversation! Your thoughts help the community grow.