Could I NGEN my application before add it into the setup package?
It seems the NGEN is used after the program is installed on target machine? Could I NGEN my program, add it into the setup package, and distribute the package so that the end user will not cost his time on waiting the ngen processing?
No. NGEN optimizes the assembly
specifically for the machine that it's running on. If you ran NGEN on yours, the assembly would be optimized for your computer, not for theirs (and it's not possible anyway).
NGEN is a totally optional step... you don't have to do it. Try not NGENning your app and all and see how well it runs. You might be suprised :)
-Ryan / Kardax
Yes, I know it is designed as such at this time. What I mean is if it could be designed as what I want : NGEN a program on my machine with a platform architecture specified(e.g. i586, so it could run on almost every machine), and redistribute ngen'ed image.
I have tried my program without NGEN. It's fast in small scale, but slow when a lot of data is loaded or the logic is very complex.
Thanks!
No, as nice as this would be, there's no way to do it.
If it were possible to pre-NGEN a file, statically linking the used parts of the framework wouldn't be much of a stretch (thus making your EXE bigger, but eliminating the need for a 20MB+ framework dependancy), but I haven't seen any effort (or even interest) from Microsoft in such a feature.
-Ryan