Tiny, fast ASP.NET Core APIs with native AOT | .NET Conf 2023

.NET 8 introduces support for publishing ASP.NET Core applications to native AOT for lightning-fast startup times & small, self-contained, native executables & containers. This session will provide an overview of when you might want to consider publishing native AOT for your ASP.NET Core APIs and demonstrate the benefits and compatibility considerations.

Why AOT?

  • Smaller apps

  • Faster startups

  • Less memory usage


Create a new Api Project and publish. The output is as below.

Self Contained Deployment

By default, the output is framework-dependent. If you want your output independent of the running environment, you may use self-contained. This will include the framework.

Output will include the framework runtime which makes the size very large.

How will Native AOT Will Help?

Enable Nati AOT by adding below to csproj.



It has fewer defaults and is lighter. Use with Native AOT.

The output will have approximately 10 MB for Windows.


It creates an empty builder but you need to configure what you need. The output will be smaller.