Developer knowledge network · moderated exchange

مجتمع الكود غير الموثوق به

أبحاث المطورين، مجتمع الهندسة العكسية والترميز

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 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
مندوب: 162
تاريخ الانضمام: May 2018
دعامات: 73
شكرًا: 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
مندوب: 68
تاريخ الانضمام: Mar 2019
دعامات: 22
شكرًا: 57
1 months ago · Jul 16, 2026 12:36 AM
#3

NativeAOT single file binaries are so convenient to distribute.