Was simply asking about encrypting builds. Sorted now, thanks all<3
2 Answers
Managed assemblies are relatively easy to reverse engineer, predominantly because the IL code omitted by the compiler is already very readable but you can read more about that elsewhere.
A common approach to preventing, or rather attempting to prevent, somebody from reverse engineering a managed assembly is obfuscation. An obfuscator will load meaningful data from the assembly and then make it difficult to read by using a variety of techniques such as scrambling identifiers and replacing string literals with verbose arithmetic functions.
The best obfuscator that I have come across, and I deem it the best because it is the obfuscator that I see reverse engineers complaining about the most, is Confuser (open source).
The Confuser UI is based on a somewhat pluggable core API that you can reference from your application to confuse the assembly that your program ommits. I suppose you could copy and credit some of the code in order to obfuscate your string of code in memory but as far as I know you will need to parse the code so that you can identify members and such as where Mono.Cecil (also open source and used by confuser) will be able to identify members and such in your code using the assembly metadata.
Obfuscation is okay and will likely protect your assembly from a rookie or lazy reverse engineer if the obfuscator is up to date. Open source tools like de4dot make light work of reversing the effects of popular obfuscators.
But remember "protection through obfuscation is no protection at all"
Update
In order to obfuscate the code before the assembly is built, you will need a parser that will present to you all of the identifiers and expressions in your code. From there you can work to generate random meaningless names for identifiers and amend the expressions to make as little sense as possible.
For example Console.Writeline("Hi")
becomes:
Console.WriteLine("{0}{1}", (char) (36 << 1), (char) ((26 << 2) + 1));
which is very difficult to read. I made that up on the spot and obviously doesn't conform to any algorithm because the bit shifting will likely lose important bits. But like I said before, go check out some other sources for algorithms you can copy and credit.

- 1
- 1

- 7,714
- 2
- 28
- 46
-
i added more to my question. Please read that, the issue is making the build obfuscated. – Metab Jan 29 '13 at 22:12
-
@Metab I updated the response pal. Doing this dynamically will lead to at least 2 more specific questions (parsing and obfuscating) but you can do it manually pretty easily. – User 12345678 Jan 30 '13 at 15:56
Every .Net assembly can be disassembled with tools like .Net Reflector. That the assembly was built with Codedom makes no difference. If you want to make it harder for others to make sense of your disassembled assemblies you would have to "obfuscate" them, just googling or searching here for ".Net obfuscator" should lead you on your way.

- 1,084
- 7
- 14