Building native libraries

Publishing .NET class libraries as Native AOT allows creating libraries that can be consumed from non-.NET programming languages. The produced native library is self-contained and doesn't require a .NET runtime to be installed.

Note

Only "shared libraries" (also known as DLLs on Windows) are supported. Static libraries are not officially supported and may require compiling Native AOT from source. Unloading Native AOT libraries (via dlclose or FreeLibrary, for example) is not supported.

Publishing a class library as Native AOT creates a native library that exposes methods of the class library annotated with UnmanagedCallersOnlyAttribute with a non-null EntryPoint field. For more information, see the native library sample available in the dotnet/samples repository on GitHub.