NGEN.exe, how to use it and can it be used in an MSI??

Posted on 2005-03-11
Medium Priority
Last Modified: 2011-04-14
I have been reading how the ngen.exe may help the launch time of an application, but I was hoping someone could shed more light on how to use it.

Here is my scenerio.

My application has extremely slow launch time and I am assuming its because its compiling very large shared assemblies that are from MapInfo.  There are 6 assemblies in total that it uses and the start up time is in excess of two minutes.

Will NGEN.exe benefit me?
Do I only have to apply it the main executable?
If not can I apply it to Mapinfo assemblies?

And if I could do any of these, can it be used in a installation Package ?

Thanks for the help!
Question by:leonardjp
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 25

Accepted Solution

RonaldBiemans earned 2000 total points
ID: 13517847
My guess is,it will benefit you since you use shared assemblies, you could apply it to the main executable or to the individual assemblies. And yes you can do it in your setup (you must add ngen  to your installation package though).

If you use a lot off dlls in your program you might also want to consider changing the base addresses of these dlls,
(Windows can load DLLs much faster if they don't have to be rebased) this is especially true if the dll has been precompiled with the Ngen Utility

use like

ngen mainapp.exe Assembly1.dll Assembly2.dll assembly3.dll

when this syntax is used, ngen compiles all the dlls and optimizes them for executing in the main application's context, taking the applications configuration file into account.
LVL 25

Expert Comment

ID: 13517884
To change the base address of your dll, use the properties of your project, choose configuration properties, choose optimizations. try keeping the values far enough apart so that dll don't overlap in memory
LVL 25

Expert Comment

ID: 13517902
But keep in mind that it will load faster, but it will probably run slower.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 13522314
Could you explain, in a little more detail, how to add ngen to the installation package?

Author Comment

ID: 13524764
Also, I am creating the MSI using MapInfo Merge Modules, will NGEN be any help to me?
LVL 25

Expert Comment

ID: 13532845
To add ngen to your installation package just add it in the file system of your installation package, and run it in a custom action in the commit phase. I'm afraid I have no experience with mapinfo merge modules so I'm no help there :-)

Author Comment

ID: 13537261
Thanks for the help.  I have changed the base address of my dlls and that has appeared to work a little.   I'll attempt the NGEN and compare the performance.  thanks again.

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question