What is Native Image Generator (Ngen.exe)?

Native Image Generator

The Native Image Generator (Ngen.exe) generates a native binary image for the current operating systems. It is stored in a native image cache on the local computer. It allows the assembly to load and execute faster, because it restores code and data structures from the native image cache rather than generating them dynamically.


Using native images typically benefits applications by improving their startup times. After the Native Image is generated, .NET runtime will use the image to run the code rather than from the hard disk. So when an assembly is executed, the CLR first looks for a native image based on the above factors, if not found, it reverts to JIT runtime compilation. When compared to Native Image, MSIL code is loading slow because of JIT compilation and type-safety verification.


The above command generates a native image for MyApp.exe, located in the current directory, and installs the image in the native image cache.

The above command generates a native image for MyApp.exe with the specified path.


The above command uninstalls the MyDll.dll from the previous example.

 (C) 2023    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About