I stumbled across David Notario's blog earlier today, and found a really good article describing the new native image generation (NGEN) service that has been introduced in .NET Framework 2.0 beta 2. I'm sure some of you have noticed mscorsvw.exe running in the background after installing the .NET Framework or Visual Studio and wondered why it was using processor time and what it was doing, and his blog post describes the service and lists some issues that have been encountered with the service and workarounds for them.
Most notably, if you run into an error message that lists the CLR Optimization Service while installing the .NET Framework 2.0 beta 2 or later, you can use the following commands to disable the version of the CLR Optimization Service on your machine in order to unblock setup.
Note: you will need to change the build number to match the version of the service that is actually installed on your computer, you can run sc.exe query and look at the output to figure out which version of the service is currently installed
sc.exe stop clr_optimization_v2.0.50215_32
sc.exe config clr_optimization_v2.0.50215_32 start=disabled
sc.exe stop clr_optimization_v2.0.50215_64
sc.exe config clr_optimization_v2.0.50215_64 start=disabled
In addition to describing the NGEN service, David's blog post links to an MSDN article written by Reid Wilkes (a tester on the CLR team and a University of Oklahoma alumnus like me 🙂 ). Reid's article describes what NGEN is, what is new for NGEN in the .NET Framework 2.0, how to use the various commands that are supported by ngen.exe and how to decide whether or not you should use NGEN when installing your own assemblies. I'd encourage anyone developing managed assemblies with the .NET Framework 2.0 or builidng setup packages that install .NET Framework 2.0 assemblies to read through this article.