NGen.exe question

G

Guest

Hi people

I tried to use ngen.exe on an executable generated by C#, but I don't see where the generated executable is placed. I use it as follows (from the tools menu)

ngen.exe "$(ProjectDir)bin\release\myprogram.exe

The output goes to the output window, and it doesn't say it failed. But the original file doesn't appear to have changed, and I don't see a new executable appear. Am I doing something wrong

Another question. How can I make the tools window take the program executable as an argument, without specifying it like I did above? I don't see a tag for the executable

Thank you
Tom
 
J

Jochen Kalmbach

=?Utf-8?B?VFQgKFRvbSBUZW1wZWxhZXJlKQ==?= said:
Hi people,

I tried to use ngen.exe on an executable generated by C#, but I don't
see where the generated executable is placed. I use it as follows
(from the tools menu):

ngen.exe "$(ProjectDir)bin\release\myprogram.exe"

The output goes to the output window, and it doesn't say it failed.
But the original file doesn't appear to have changed, and I don't see
a new executable appear. Am I doing something wrong?

No... but maybe you misunderstood something...

ngen does only put the pre-compiled assembly in the image cache (%WINNT%
\assembly). It does not change the assembly at all.
And therefor it works only on the target machine.
You cannot deploy pre-compiled assemblies...

Another question. How can I make the tools window take the program
executable as an argument, without specifying it like I did above? I
don't see a tag for the executable.

Use "${TagretPath}" instead of "$(ProjectDir)bin\release\myprogram.exe"

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/tools/leakfinder.asp


Do you need daily reports from your server ?
http://sourceforge.net/projects/srvreport/
 
G

Guest

Hi Jochen

Indeed I must have misunderstood. I thought it would make an executable that is compiled to ASM for the platform. Is that true? If not, what is ngen for then

You say that ngen.exe is only for assemblies. When I compile my program using C#, I assume that it generates an assembly? Is that the same as the executable

I do not seem to find anything in %WINNT%\assembly, so actually ngen appears to have done nothing

Thanks
Tom

----- Jochen Kalmbach wrote: ----

=?Utf-8?B?VFQgKFRvbSBUZW1wZWxhZXJlKQ==?= wrote
Hi people
see where the generated executable is placed. I use it as follow
(from the tools menu):
But the original file doesn't appear to have changed, and I don't se
a new executable appear. Am I doing something wrong?

No... but maybe you misunderstood something..

ngen does only put the pre-compiled assembly in the image cache (%WINNT
\assembly). It does not change the assembly at all
And therefor it works only on the target machine
You cannot deploy pre-compiled assemblies..

Another question. How can I make the tools window take the progra
executable as an argument, without specifying it like I did above?
don't see a tag for the executable.

Use "${TagretPath}" instead of "$(ProjectDir)bin\release\myprogram.exe

--
Greeting
Joche

Do you need a memory-leak finder
http://www.codeproject.com/tools/leakfinder.as


Do you need daily reports from your server
http://sourceforge.net/projects/srvreport
 
B

babylon

after you compile a C# program; it will produce an .exe assembly which
contains MSIL.
MSIL normally compiles to native codes when you run it, or
it can pre-compiles to native codes using ngen.exe
Running ngen.exe generate a native image of the program and stored under
%WINNT%\assembly.
However, the originally .exe is still needed to run the program.

Running a program which has a native image in %WINNT%\assembly would
eliminate the need of compiling (JIT) MSIL to Native code; which means load
time is reduced

however, ngen doesn't always give you the fastest code; as many
optimizations can be done if you use JIT compiler, which is not feasible
when using ngen.

TT (Tom Tempelaere) said:
Hi Jochen,

Indeed I must have misunderstood. I thought it would make an executable
that is compiled to ASM for the platform. Is that true? If not, what is ngen
for then?
You say that ngen.exe is only for assemblies. When I compile my program
using C#, I assume that it generates an assembly? Is that the same as the
executable?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top