Developer knowledge network ยท moderated exchange

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Knowledge indexLive
4Categories
919Threads
2.8KPosts
Guide

NativeAOT compilation: compiling C# to pure standalone x64 native binaries [v2.4 Technical Discussion]

dotnet_native_aot
C# Veteran
MEMBER
Rep: 174
Join Date: Sep 2021
Posts: 16
Thanks: 62
1 months ago ยท Jul 15, 2026 7:58 AM
#1

How to compile C# CLI tools and memory utilities directly to native machine code in .NET:

In .csproj:

XML
<PropertyGroup>
  <PublishAot>true</PublishAot>
  <OptimizationPreference>Speed</OptimizationPreference>
  <InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
dotnet publish -c Release -r win-x64

Output: A tiny 6.5MB standalone .exe with no .NET runtime or DLL dependencies that boots in 3 milliseconds!

ptr_arithmetic
C++ Wizard
MEMBER
Rep: 162
Join Date: May 2018
Posts: 73
Thanks: 42
1 months ago ยท Jul 15, 2026 1:00 PM
#2

3ms startup time is incredible for CLI offset dumpers and scanner utilities.

segfault_sam
Member
MEMBER
Rep: 68
Join Date: Mar 2019
Posts: 22
Thanks: 57
1 months ago ยท Jul 16, 2026 12:36 AM
#3

NativeAOT single file binaries are so convenient to distribute.