Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparing the size of minimal and controller based APIs in .NET

Is the ASP.NET Core 6 minimal API supposed to create a smaller app compared to the classic controller based approach?

From the Microsoft documentation

Minimal APIs are architected to create HTTP APIs with minimal dependencies. They are ideal for microservices and apps that want to include only the minimum files, features, and dependencies in ASP.NET Core.

But when you create two default apps in Visual Studio, one minimal and one controller based (both containing the same default Weather forecast endpoint) and publish the apps, they are pretty much the same size. Publishing as framework dependent apps, both end up at just around 4 MB.

Am I missing something here? I would expect the minimal API to be smaller.

like image 295
Q-bertsuit Avatar asked Oct 12 '25 04:10

Q-bertsuit


1 Answers

I haven't seen an official explanation but would assume the term minimal refers to the amount of boilerplate and ceremony rather than the actual binary filesize.

like image 74
Oliver Weichhold Avatar answered Oct 14 '25 21:10

Oliver Weichhold