Managed .NET code (MSIL) can be decompiled and due to this it can be obfuscated to make this much harder, if not impossible. In contrast to this is native code quite secure looking at this threat.
However, there is a way to turn managed code into precompiled native code using a tool called NGen.exe, which is part of the SDK. It speeds up code execution quite a bit.
The question is: Can you use Ngen to deploy native code only, e.g. on security sensitive systems?
Unfortunately, you cannot, because the Common Language Runtime still needs the metadata contained in the IL-code e.g. for reflection etc..
Therefore use NGen only for better speed, not for security!
Alexander![]()