Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!

I wonder where is the binary file located after Ive compiled the .exe or .dll assembly using the ngen.exe. I have a .NET 4 assembly (in C#) and want to remove MSIL and leave the native code to bypass JIT compilation at runtime. I do this in command line compiler:

C#
ngen install myAssemblyName.exe


and it approves to have installed in native image cache but I dont know where it is. Can anyone help?

Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 10-Feb-12 3:41am    
I wonder why?
--SA

1 solution

As far as I understand, you never need to know that. You are not using the native image in cache directly. You will keep using the same assembly executable module file to run your application, exactly as you would do before using Native Image Generator. The generated native image will only be used during run time to prevent JIT operation through using pre-compiled native code. You may only see the difference in performance (do not expect dramatic improvements because JIT is effective enough for most applications).

You can read about other effects of using the native image:
http://msdn.microsoft.com/en-us/library/6t9t5wcf%28v=vs.100%29.aspx[^].

[EDIT #1]

Native images are typically named like "*.ni.dll", "*.ni.exe".

[EDIT #2]

This is a good in-depth Microsoft Magazine article: http://msdn.microsoft.com/en-us/magazine/cc163610.aspx[^].

—SA
 
Share this answer
 
v4
Comments
Manfred Rudolf Bihy 10-Feb-12 3:59am    
Moved from non-solution: Thank you for quick answer. One more please: I have read that article you pointed. I wonder if it is enough to simply install the binary into the native image cache and forget about it. Are there any references required or it automatically resolves the location of that assembly at runtime? Thanks again!
Sergey Alexandrovich Kryukov 10-Feb-12 4:18am    
I remember I saw some references in MSDN just recently; when I saw your question, failed to find it quickly, sorry. I found it a while ago, so you could, too, by adding the key words ("resolve" OR "resolution"). I usually use very simple resolution which should not cause any problems, so I did not really think about the resolution problem...
--SA
Sergey Alexandrovich Kryukov 10-Feb-12 4:40am    
[Misplaced -- SA]
Sergey Alexandrovich Kryukov 10-Feb-12 4:18am    
If I come across this detail again, I'll notify your.
--SA
Sergey Alexandrovich Kryukov 10-Feb-12 4:21am    
Yes, basically, this is correct: you should install the image and forget, but more exactly, not forget it forever. If you want to remove the application later on, you need to remove the generated native image from cache first, using ngen.exe.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900