Developer knowledge network · moderated exchange

Społeczność UnreliableCode

Badania programistów, inżynieria wsteczna i społeczność programistów

Knowledge indexNa żywo
4Categories
919Threads
2.8KPosty
Guide

NativeAOT compilation: compiling C# to pure standalone x64 native binaries

dotnet_native_aot
C# Veteran
MEMBER
Rozpustnik: 174
Data dołączenia: Sep 2021
Posty: 16
Dzięki: 62
1 miesięcy temu · Jul 10, 2026 10:49 PM
#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
Rozpustnik: 162
Data dołączenia: May 2018
Posty: 73
Dzięki: 42
1 miesięcy temu · Jul 11, 2026 12:54 AM
#2

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

segfault_sam
Member
MEMBER
Rozpustnik: 68
Data dołączenia: Mar 2019
Posty: 22
Dzięki: 57
1 miesięcy temu · Jul 11, 2026 1:26 PM
#3

NativeAOT single file binaries are so convenient to distribute.