VB.NET - What is a native image?

What is a native image?

- A native binary image for the current operating systems is generated by the Native Image Generator (Ngen.exe).
- They are stored in a native image cache on the local computer.
- It restores the code and data structures from the native image cache rather than generating them dynamically because it allows the assembly to load and execute faster.
- By using the native images it will benefit the applications by improving their startup times.
- .NET runtime will use the image after it is generated to run the code rather than from the hard disk.
- Once an assembly is executed, the CLR first looks for a native image based on the above factors and if it is not found, it will revert to the JIT runtime compilation.
- When compared to Native Image, MSIL code is loading slow because of JIT compilation and type-safety verification.

Usage of native image:

1.ngen install MyApp.exe

This command generates a native image for MyApp.exe which is located in the current directory, and it will install the image in the native image cache.

2.ngen install c:\project\MyApp.exe

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

Uninstall

1. ngen uninstall c:\project\MyDll.dll /ExeConfig:c:\project\MyApp.exe
This command will uninstall the MyDll.dll.
VB.NET - What is a bootstrapper application?
VB.NET - What is a bootstrapper application? - A bootstrapper application automatically detects if Windows Installer is installed on the target machine.......
VB.NET - Discuss about imperative and declarative security
Discuss about imperative and declarative security - Declarative security: Security requests are made in form of attributes......
VB.NET - How do we access crystal reports in .NET?
How do we access crystal reports in .NET? - Add a new web project......
Post your comment