Developer knowledge network · moderated exchange

UnreliableCode-Community

Community für Entwicklerforschung, Reverse Engineering und Codierung

Knowledge indexLive
4Categories
919Threads
2.8KBeiträge
Guide

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

dotnet_native_aot
C# Veteran
MEMBER
Vertreter: 174
Beitrittsdatum: Sep 2021
Beiträge: 16
Danke: 62
Vor 1 Monaten · 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
Vertreter: 162
Beitrittsdatum: May 2018
Beiträge: 73
Danke: 42
Vor 1 Monaten · Jul 15, 2026 1:00 PM
#2

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

segfault_sam
Member
MEMBER
Vertreter: 68
Beitrittsdatum: Mar 2019
Beiträge: 22
Danke: 57
Vor 1 Monaten · Jul 16, 2026 12:36 AM
#3

NativeAOT single file binaries are so convenient to distribute.