0

Im new to Native Code Generation in .Net 4.0. In my project there are totally 500+ DLL file for a single EXE file. If I have to create a Native Image for all those DLL using ngen.exe install it is going to be a big process. So My question is whether there is any tool or script to create the Native Image for all those DLL files. Please help me with this problem.

Thanks in Advance.,

leppie
  • 115,091
  • 17
  • 196
  • 297

2 Answers2

2

Just use the DOS 'FOR' command:

FOR %x IN (*.dll) DO ngen install %x
leppie
  • 115,091
  • 17
  • 196
  • 297
  • Thank you. how can I access it in Command Prompt. Please explain me a little what %DLL implies to. It shows an error like "%DLL is Unexpected at this time" in Command Prompt. – user177777 Jul 19 '11 at 05:51
  • Oops, it might want a single character variable like %x. – leppie Jul 19 '11 at 05:57
1

Just quoting the very first paragraph of the Examples section of the Ngen.exe documentation page in MSDN:

The following command generates a native image for ClientApp.exe, located in the current directory, and installs the image in the native image cache. If a configuration file exists for the assembly, Ngen.exe uses it. In addition, native images are generated for any .dll files that ClientApp.exe references.

ngen install ClientApp.exe

So maybe RTFM?

Nowhere man
  • 5,007
  • 3
  • 28
  • 44
  • -1: RTFQA. Also relying on a exe to reference every dll is naive. – leppie Jul 19 '11 at 05:58
  • I tried that already. But the output shows with "you are missing some Dependencies" for the DLL that Im not mentioning in the Ngen insatll format. – user177777 Jul 19 '11 at 06:09
  • Just a tip: if you already tried the documented way to do X, don't ask "how do I do X?", but "I tried to do X the documented way, got Y as error message, what's wrong?"... People can't guess what you did and what happened. – Nowhere man Jul 19 '11 at 15:10