10

I wonder if total decompilation of arbitrary non packed project .NET is possible? If no, what is the conditions that should be met to make it possible? If yes, is there tools that can automate this? I'm wondering not about basic decompilers, but about the ability of complete project recovery to compile result with VS again.


UPD1

Yet tried to apply only dotPeek for my case. Unfortunately the output is not looks like ready-to-go project but all errors seems to be debugable. Disadvantage is the inability to export both dlls and exe into one project automatically(poor man's editing .sln file required)

UPD2

Seems like ILSpy has no option of export ready-to-go solutions for one/multiple .NET assemblies. Maybe there is some plugin/extension that should handle this? Will update this post if find one.

  • tip: .NET reflector + reflexil – rev Feb 12 '15 at 14:17
  • What's the end game for this? Are you trying to re-compile into a working .net binary after changes? If so, maybe there's a better way. – baordog Feb 12 '15 at 15:32
  • @baordog say I've working exe and bunch of dll written in .NET and I'd like to make a sort of fork of this project for personal use – see ya Feb 12 '15 at 20:40
  • You might have an easier time just modifying the binary. The decompiled "project" will be quite hard to interpret as it is, and there's no guarantee it will build properly. – baordog Feb 12 '15 at 20:51
  • @baordog well, I believe that binary modification is not way of writing the code. My question is about conditions that allows to get properly recovered project and the obstacles that will not allow me to solve this task. In other words about opportunities and limitations of existing tools/techniques. – see ya Feb 12 '15 at 21:25
10

JetBrains dotPeek is a free decompiler that has the option of decompiling whole assemblies into VS projects:

  • I've recently done this with dotPeek, which also decompiles submodules of the target project. After some tweaking I was able to recompile the project. – Dominik Antal May 14 '15 at 15:00
  • 1
    JustDecompile definitely generates better projects from my experience. – Mark Twain May 6 '16 at 6:54
4

Update: dnSpy is now my go to tool for .net decompiling. It's open-source, it exports to Visual Studio projects and the debugger works like a charm.

https://github.com/0xd4d/dnSpy

Original answer: Telerik JustDecompile also can export to Visual Studio projects. I used it recently and it worked with very minor modifications to the code. It's a free tool.

http://www.telerik.com/products/decompiler.aspx

  • I tried it and it gave me all this weird uncompilable syntax, like foo.<Bar>Baz, foo.$this, etc, IIRC. – flarn2006 Oct 7 at 3:59
2

I wonder if total decompilation of arbitrary non packed project .NET is possible?

Tools like ILSpy do a great job with decompilation of arbitrary non-packed .NET binaries.

If yes, is there tools that can automate this?

ILSpy is open-source, so you can write your own code to automate the decompilation process.

  • Looks like the answer is actually "no" and this tool allows only write my own solution if needed. – see ya Feb 12 '15 at 13:58
1

Have you tried tools like:

For C#/VB

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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