Developer knowledge network · moderated exchange

UnreliableCode қауымдастығы

Әзірлеушілерді зерттеу, кері инженерия және кодтау қауымдастығы

Knowledge indexТірі
4Categories
919Threads
2.8KЖазбалар
Guide

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

dotnet_native_aot
C# Veteran
MEMBER
Өкіл: 174
Қосылу күні: Sep 2021
Хабарламалар: 16
Рахмет: 62
1 ай бұрын · 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
Өкіл: 162
Қосылу күні: May 2018
Хабарламалар: 73
Рахмет: 42
1 ай бұрын · Jul 15, 2026 1:00 PM
#2

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

segfault_sam
Member
MEMBER
Өкіл: 68
Қосылу күні: Mar 2019
Хабарламалар: 22
Рахмет: 57
1 ай бұрын · Jul 16, 2026 12:36 AM
#3

NativeAOT single file binaries are so convenient to distribute.