Which utility compiles managed assemblies to processor-specific native images ahead of time (AOT) to improve startup performance?
C# Programming
.NET Framework
Difficulty: Easy
Choose an option
-
Agacutil
-
Bngen
-
Csn
-
Ddumpbin
-
Eildasm
Answer
Correct Answer: ngen
Explanation
Introduction / Context:Some .NET tools optimize deployment and performance by preparing native images before runtime.
Given Data / Assumptions:
- We need the tool that generates native images from managed assemblies.
- The goal is reduced JIT cost at startup.
Concept / Approach:Native Image Generator (ngen.exe) produces machine-specific native images that the CLR can load instead of JIT-compiling IL at startup.
Step-by-Step Solution:
Identify each tool's purpose.gacutil: manages assemblies in the GAC.sn: strong-name utilities for key generation and signing.dumpbin: PE/COFF inspection tool (Visual Studio).ildasm: disassembles IL; not a compiler.Only ngen performs AOT native image generation.Verification / Alternative check:Documentation shows ngen.exe as the AOT compiler for .NET Framework.
Why Other Options Are Wrong:
- gacutil: assembly storage, not compilation.
- sn: signing, not compilation.
- dumpbin: inspection, not compilation.
- ildasm: disassembly, not compilation.
Common Pitfalls:Confusing IL disassembly with native image generation.
Final Answer:ngen