Is it posible Generate Native Codes for .NET Assemblies without NGEN.EXE utility (Programly).

Dear Sirs.

Is it posible Generate Native Codes for .NET Assemblies without NGEN.EXE utility (Programly).


1) Genereate it during an installation
2) Genereate it on first run of application
3) Get a List of NGEN Buffer.

Thank you in Advance.

[281 byte] By [IrakliLomidze] at [2008-1-10]
# 1
Irakli,

well, the three things you are asking for is basically what nget is good for. is there any reason why you don't want to use ngen?

apart from that: afaik, there's no 'easy' alternative support for creating native images from msil (apart from the jitter). obviously, you could write your own msil to x86(or whatever) compiler - however, i doubt if this is a reasonable thing to do.

WM_MY0.02$
thomas woelfer
http://www.die.de/blog

thomaswoelfer at 2007-8-20 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 2

I think the crux of what you are asking is, can you control when ngen executes without having to have the user do this for you.

The answer is yes. You can do this.

1) during an installation: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxwlkwalkthroughusingcustomactiontoprecompileassermblyduringinstallation.asp
2) app first run: follow the same execution code in the last article but do it when the application starts.
3) Not really sure how this would be done.

HTH

Tobin

ttitus at 2007-8-20 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 3
Irakli Lomidze wrote:

Dear Sirs.

Is it posible Generate Native Codes for .NET Assemblies without NGEN.EXE utility (Programly).


1) Genereate it during an installation
2) Genereate it on first run of application
3) Get a List of NGEN Buffer.

Thank you in Advance.


Irakli,

It should also be noted (in addition to the other responses) that using NGEN to pre-compile your assemblies will basically eliminate any optimizations that the CLR can apply based on run-time analysis (which is a definite possibility in the future).

- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

casperOne at 2007-8-20 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 4
for 3) Get a List of NGEN Buffer
if you mean the negened files ?

yes you can do this easily by navigating to c:\windows\assembly\NativeImages1_v1.1.4322
this is for v 1.1
and there is another folder for v 2.0

and by the way you can use reflection.emit to create types at runtime (like building scenarios in a strategy game on the fly) and then comppile it programatically at run time also . this is used also in AI . so when we find a solution for a problem at runtime we create types for solving this prob and then compile these types , so the system can never face this prob again . and if it happens the solution is ready and compiled .

you can read about ngen 2 enhancements here

Regards,
Hussein Ahmad
http://HusseindotNET.BlogSpot.com

HusseinAhmad at 2007-8-21 > top of Msdn Tech,.NET Development,Common Language Runtime...

.NET Development

Site Classified