问题
Can I use mono's AOT (Ahead of Time compilation) feature to natively "pre-compile" all or part of some of my own .NET DLLs (and or EXEs) to make them harder to reverse engineer? I'm using Windows (7 / x64 but I have an x86 XP machine as well) and .NET 3.5 (VS 2008) and I'm curious if mono/AOT can be/has been used for this purpose? (Tying them to x86 is acceptable at this point.)
See also this question where I tried this and had no luck.
回答1:
AFAIK, mono's AOT doesn't remove the metadata which means a hacker has lots of information to try to understand the logic in your code. Also it isn't available for all processors and platforms (specifically I think it isn't available on Windows). It is easier to try some commercial obfuscators that do just that, while taking away most of the metadata.
回答2:
The IL code in assemblies can be removed once the code has been precompiled (this is what we do for monotouch, for example, to reduce app download size). There are a few restrictions, but it works. Whether you should go to such lengths to screw your costumers with obfuscation is another matter, though.
回答3:
Short answer, no.
AOT'ing an assembly will only generate a shared library so the next time you use that assembly, Mono will not have to JIT-compile the methods that you use, but instead it will load them from the .so. Your assembly needs to be there because the metadata in it is still needed.
来源:https://stackoverflow.com/questions/2587118/can-i-use-monos-aot-feature-to-natively-pre-compile-net-dlls-exes-to-make-th