1
  1. Can we decompile a .exe or .dll file as 100%? Also sometimes seems some mistakes on somewhere (like mainfrm.cs) , how can we fix that?
  2. What is the best .NET decompiler? or What would you prefer?

I wanna get an answer for my questions. Thanks!...

2
  • 2
    Decompilation is not something you can easily perform programmatically, some tools try but eventually you'll have to have a human do at least some of the work. – NirIzr Sep 2 '17 at 20:28
  • Could you be more clear? so when i decompiled a file it was giving like 140+ errors, couldn't fix it... – Busi Sep 2 '17 at 20:31
3

Since the compilation output of .NET languages is MSIL, which is quite readable itself, it can be transformed back to (almost) original source code.
There are many applications which can do that.
My favourite is dnSpy since it's free, open source and has debugging functionalities. AFAIK it can even try to build a Visual Studio Solution (.sln) file from your input which should be what you look for.

But under certain circumstances some information is lost during the compilation process.
You would have to manually fix those errors. For example anonymous functions can confuse a decompiler easily. And of course - if the developer tries to protect his application there are various techniques like obfuscation which would make your life harder.

So to answer your questions directly:

  1. In most cases there isn't a 100% Plug and Play solution. You will have to fix a few things yourself if you want to have a recompilable project.
  2. Since best .. is very subjective here are a few suggestions (in no particular order):
    1. https://github.com/0xd4d/dnSpy (free, open source)
    2. https://www.red-gate.com/products/dotnet-development/reflector/ (paid)
    3. https://www.jetbrains.com/decompiler/ (free?)
    4. http://ilspy.net/ (free, open source)

Not the answer you're looking for? Browse other questions tagged or ask your own question.