Starting from .NET Core 3.x tiered compilation is enabled by default. This allows you to use precompiled code from assemblies created using the ReadyRoRun(R2R format. R2R is a form of ahead-of-time (AOT) compilation.
It improves startup performance by reducing the amount of work the just-in-time (JIT) compiler needs to do as your application loads.
To use this feature you need to enable ReadyToRun and publish your application as a self-contained app.
-
Add the
<PublishReadyToRun>
setting to your project:<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup> -
Publish a self-contained app. Here is an example targetting the Linux ARM64 runtime:
dotnet publish -c Release –r linux-arm64 --self-contained