Native Image Generator

Service of the .NET framework

"NGen" redirects here. For other uses, see NGEN (disambiguation).

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Native Image Generator" – news · newspapers · books · scholar · JSTOR (July 2025) (Learn how and when to remove this message)

|

The Native Image Generator, or simply NGen, is the ahead-of-time compilation (AOT) service of the .NET Framework.[1] It allows a CLI assembly to be pre-compiled instead of letting the Common Language Runtime (CLR) do a just-in-time compilation (JIT) at runtime. In some cases the execution will be significantly faster than with JIT.

## General information

[edit]

The Native Image Generator produces a native binary image for the current environment (i.e.; operating systems). This eliminates the JIT overhead at the expense of portability and disk space; whenever an NGen-generated image is run in an incompatible environment, .NET Framework automatically reverts to using JIT. Once NGen is run against an assembly, the resulting native image is placed into the Native Image Cache (NIC) for use by all other CLI assemblies. This makes it possible, for example, to use NGen to process CLI assemblies at installation time, saving processor time later on, when the end-user invokes the application on their system.

NGen is intended to make the assembly execute faster by removing the JIT compilation process at runtime, but this does not always improve performance because some optimizations can be done only by a JIT compiler (e.g., if the JIT compiler knows that the code is already running with full trust, it can skip certain expensive security checks). Because of this fact, it makes sense to use NGen only after benchmarking the application performance before and after it.

## See also

[edit]

* Common Language Infrastructure (CLI)
* Common Intermediate Language (CIL)
* Global Assembly Cache (GAC)
* CoreRT

## References

[edit]

1. ^ Vermeir, Nico (2022). "Runtimes and Desktop Packs". Introducing .NET 6. Berkeley, California: Apress. doi:10.1007/978-1-4842-7319-7_2.

## External links

[edit]

Wikibooks has a book on the topic of: .NET Development Foundation

* Common Language Infrastructure (Standard ECMA-335)
* “ECMA C# and Common Language Infrastructure Standards” on MSDN
* Speed: NGen Revs Up Your Performance With Powerful New Features - MSDN Magazine, April 2005

* v
* t
* e

.NET

* .NET strategy
* Libraries and frameworks

Implementations|

* .NET (Core)
* .NET Framework
* Version history
* .NET Compact Framework
* .NET Micro Framework
* DotGNU
* Mono
* XNA Framework

Architecture|

* Common Language Runtime (CLR)
* COM Interop
* Framework Class Library (FCL)

Components|

* ADO.NET
* Entity Framework
* ASP.NET
* Web Forms
* AJAX
* Core
* Dynamic Data
* MVC
* Razor
* Avalonia
* ClickOnce
* Dynamic Language Runtime
* Extensible Application Markup Language (XAML)
* Language Integrated Query (LINQ)
* Managed Extensibility Framework
* Microsoft Silverlight
* Microsoft XNA
* Parallel Extensions
* Windows Communication Foundation (WCF)
* WCF Data Services
* Windows Forms (WinForms)
* Windows Identity Foundation (WIF)
* Windows Presentation Foundation (WPF)
* Windows Workflow Foundation (WF)
* .NET Remoting

Tools|

| Decompilers|

* .NET Reflector
* dotPeek

|

Obfuscators|

* Dotfuscator
* SmartAssembly

* CLR Profiler
* ILAsm
* .NET Compiler Platform
* Native Image Generator (NGen)
* XAMLPad

IDEs|

* Visual Studio
* Blend
* Express
* MonoDevelop
* SharpDevelop
* Xamarin Studio

Organizations|

* .NET Foundation
* Microsoft
* Xamarin

* Category
* List
* Commons

* v
* t
* e

Microsoft development tools

Development
environments|

| Visual Studio|

* Code
* Express
* Team System Profiler
* Tools for Applications
* Tools for Office

|

Others|

* Blend
* Expression Web
* FxCop
* GW-BASIC
* MACRO-80
* Macro Assembler
* MSBuild
* Pascal
* QuickBASIC
* QBasic
* QuickC
* Robotics Developer Studio
* Roslyn
* SharePoint Designer
* FrontPage
* Small Basic
* WebMatrix
* Windows App SDK
* Windows App Studio
* Windows SDK
* CLR Profiler
* ILAsm
* Native Image Generator
* WinDiff
* XAMLPad

Languages|

* Dynamics AX
* BASIC
* Visual Basic
* legacy
* VB.NET
* VBA
* VBScript
* Bosque
* Visual C++
* C++/CX
* C++/CLI
* Managed C++
* C++/WinRT
* C#
* C/AL
* Dafny
* Dexterity
* F#
* F*
* Visual FoxPro
* Java
* J++
* J#
* JavaScript
* TypeScript
* JScript
* IronPython
* IronRuby
* Lean
* P
* Power Fx
* PowerShell
* Project Verona
* Q#
* Small Basic
* VPL
* XAML

APIs and
frameworks|

| Native|

* Windows API
* Silverlight
* XNA
* DirectX
* Managed DirectX
* UWP
* Xbox Development Kit
* Windows Installer
* WinUI

|

.NET|

* ASP.NET
* Core
* AJAX
* Dynamic Data
* MVC
* Razor
* Web Forms
* ADO.NET
* Entity Framework
* MAUI
* CardSpace
* Communication Foundation
* Identity Foundation
* LINQ
* Presentation Foundation
* Workflow Foundation

Device drivers|

* WDK
* WDF
* KMDF
* UMDF
* Windows HLK
* WDM

Database|

| SQL Server|

* Express
* Compact
* Management Studio
* MSDE

|

SQL services|

* Analysis
* Reporting
* Integration
* Notification

Other|

* Visual FoxPro
* Microsoft Access
* Access Database Engine
* Extensible Storage Engine

Source control|

* Visual SourceSafe
* Team Foundation Version Control

Testing and
debugging|

* CodeView
* OneFuzz
* Playwright
* Script Debugger
* WinDbg
* xUnit.net

Delivery|

* Active Setup
* ClickOnce
* npm
* NuGet
* vcpkg
* Web Platform Installer
* Windows Installer
* WiX
* Windows Package Manager
* Microsoft Store

Category
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template