View Single Post
  #12 (permalink)  
Old 10-31-2007, 02:17 AM
amansundar amansundar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 325
amansundar is on a distinguished road
Smile Re: What is Ngen.exe in DotNet?

In .NET Framework 2.0 there is a service (.NET Runtime Optimization Service) which can precompile managed assemblies in the background. You can schedule your assemblies to be precompiled asynchronously by queueing them up with the NGEN Service. Use the following command line.

Code:
ngen.exe install <assemblyname> /queue:<priority>
Assemblies which are critical to your application's start up time should either be precompiled synchronously or asynchronously with priority 1. Priority 1 and 2 assemblies are precompiled aggressively while Priority 3 assemblies are only precompiled during machine idle-time. Synchronously precompiling your critical assemblies guarantees that the native images will be available prior to the first time your end user launches the application but increases the time taken to run your application's set up program.

You can uninstall an assembly and its dependencies (if no other assemblies are dependent on them) from the native image cache by running the following command.

Code:
ngen.exe uninstall <assemblyname>
Native images created using Ngen.exe cannot be deployed; instead they need to be created on the end user's machine. These commands therefore need to be issued as part of the application's setup program. Visual Studio .NET can be used to implement this behavior by defining custom actions in a Microsoft Installer (MSI) package.
__________________
cheers
Aman
Reply With Quote