.NET Framework vs .NET Core vs .NET 5/6/7/8+
Short Introduction
The .NET ecosystem has evolved from the Windows-only .NET Framework to the cross-platform .NET Core, and finally unified under .NET 5+ (dropping "Core" from the name).
Official Definition
- .NET Framework: The original Windows-only implementation of .NET, first released in 2002
- .NET Core: Cross-platform, open-source implementation of .NET, designed for modern cloud workloads
- .NET 5+: The unified platform that combines .NET Framework and .NET Core into a single product
Usage
// .NET 8 (latest) project file
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
Use Cases
- Web applications: ASP.NET Core for modern web apps
- APIs: RESTful services and microservices
- Desktop applications: WPF, WinUI, MAUI
- Mobile applications: .NET MAUI
- Cloud applications: Azure-native applications
- IoT: Lightweight applications for edge devices
When to Use / When Not to Use
Use .NET Core/.NET 5+ when:
- Building new applications
- Need cross-platform compatibility
- Targeting cloud deployments
- Require high performance
- Want modern development practices
Use .NET Framework when:
- Maintaining legacy applications
- Heavily dependent on Windows-specific features
- Using technologies not ported to .NET Core
- Enterprise applications with specific Windows dependencies
Market Alternatives, Adaptation & Pros/Cons
Alternatives
- Java Spring Boot
- Node.js with Express
- Python Django/Flask
- Ruby on Rails
- Go with Gin/Echo
Market Adoption
- High enterprise adoption
- Strong cloud presence (especially Azure)
- Growing open-source community
- Microsoft's primary development platform
Pros
- Cross-platform compatibility
- High performance
- Strong type system
- Excellent tooling (Visual Studio, VS Code)
- Rich ecosystem
- Strong Microsoft support
Cons
- Microsoft ecosystem lock-in (perceived)
- Learning curve for new developers
- Licensing costs for some Microsoft tools
- Memory usage higher than some alternatives
Sample Usage
// Program.cs - .NET 8 minimal API
var builder = WebApplication.CreateBuilder(args);
// Add services
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure pipeline
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.MapControllers();
app.MapGet("/hello", () => "Hello World!");
app.Run();