I would like to share the basics of Ngen.exe in .Net. I will first try to explain the problem then the solution, Ngen.exe.
I collected this material from various web resources and I am trying to explain it in simple words.
Problem Statement
When we run a .Net application, the code is JIT-compiled. Machine code generated by JIT is thrown away after the task compilation. So the same method must be complied with again whenever we run the application again.
Compilation of the code, again and again, is a tedious process.
Solution
Native Image Generator (Ngen.exe)
Running Ngen.exe on an assembly allows the assembly to load and execute faster because it restores the code and the data structures from the native image cache rather than generating them dynamically.
References
Ngen.exe (Native Image Generator)
Conclusion
We can improve the startup time of .Net applications using a Native image generator.