Reputation: 1919
Is it possible to decompile a .NET 2.0 binary file (*.exe) to some sort of readable code? Or if not, just extract some information from it (for example method names, debugging information, etc.)?
Upvotes: 2
Views: 2758
Reputation: 8986
You might want to look at Reflector, it should show you the assembly as C# or IL.
EDIT:
With the increased cost of Reflector, I have switched to ILSpy for my day to day needs.
Upvotes: 15
Reputation: 36287
I will Quote myself from this question earlier today:
You can never get back to the exact same source since there is no meta-data about that saved with the compiled code.
But you can re-create code out from the assembly-code.
Check out this book if you are interested in these things: Reversing: Secrets of Reverse Engineering.
Edit
Some compilers-101 here, if you were to define a compiler with another word and not as technical as "compiler", what would it be?
Answer: Translator
A compiler translates the syntax / phrases you have written into another language a C compiler translates to Assembly or even Machine-code. C# Code is translated to IL and so forth.
The executable you have is just a translation of your original text / syntax and if you want to "reverse it" hence "translate it back" you will most likely not get the same structure as you had at the start.
A more real life example would be if you Translate from English to German and the from German back to English, the sentance structure will most likely be different, other words might be used but the meaning, the context, will most likely not have changed.
The same goes for a compiler / translator if you go from C to ASM, the logic is the same, it's just a different way of reading it ( and of course its optimized ).
Regarding C#, you have already been given a lot of great tools like Reflector. However, if the Code is obfuscated you are going to have problems reading it.
Upvotes: 1
Reputation: 25505
Yes. First all .net libraries have manifests with type information it them. They can be interrogated problematically using reflection, or by using tools like reflector. Take a look at the system.reflection namespace for the classes you will need to take a look at.
Upvotes: 0
Reputation: 893
Search for Lutz Roeder and you'll find :
http://www.red-gate.com/products/reflector/
Upvotes: 1
Reputation: 251
Dropping the exe into ILDASM or Dot Net Reflector should do the trick.
Upvotes: 3