Search code examples
.netgacngen

Generating Native Images outside the Cache


I would like to use NGEN.EXE in order to generate native images of my assemblies before I create my installer. I am hoping this will keep my binaries Reflector-proof. Am I correct about this?

I have just come to understand that all native images are now being stored in the Native Image Cache. Is there a way to get native binaries which I can then package with an installer? On the other hand, is it possible to get rid of the original assemblies after generating the native images?

EDIT: I am using an application which uses a hard-coded key for encryption when talking to a server. With .NET, it becomes ridiculously easy for folks to lay their hands on the key.


Solution

  • This is very much not supported by NGEN and the .net framework, but there are 3rd party tools that can do this, google for ".net linker".

    I recommend not doing it, MS have valid reasons for not supporting this.