23

Would you recommend a free tool for exploring compiled .NET assemblies. I need to be able to:

  • Explore the assemblies' source code and visualize the IL to a CLR language of choice (C#, VB.NET, managed C++ and etc.)
  • Support navigation between the classes (via Ctrl + click on the class name for example, or other convenient way).
  • Allow examining the embedded resources in the assembly, if any (text, images etc.)
  • Capable of handling assemblies since .NET version 2.0.

Optionally, I will be glad if it supports:

  • Exporting classes to source files.
  • Integration with Visual Studio 2010 (this one need not be free) that allows for debugging the source code.
  • Integration with the Xamarin Studio IDE (former MonoDevelop) would be a plus, although I am getting too optimistic here.

I used to work with .NET Reflector a few years ago and it supported most of the above features (actually all except the Xamarin integration). I tried to use it again a few weeks ago but now it has become a commercial product and my old free version does not work anymore.

15

ILSpy is one of the more popular FOSS .NET decompilers. It's pretty intuitive to use, though I have not yet tried Reflector so I can't compare them.

Unfortunately, it doesn't completely satisfy your requirements, though it gets close. There is no support for decompiling to C++/CLI, though it does work well for IL, C# and VB.NET.

You can click on class and method names to navigate to their definitions, or analyse them through the context menu for where they are accessed. It can render both images and text from embedded resources, and allows you to save them - I have not tried other filetypes, but they should work in the same way.

You can export classes to source files, and you can even export entire assemblies into .csproj (MS build) files. For simpler projects these can be compiled directly. Many more complex projects tend to fail to compile without modification - notably, their site mentions it can't decompile and then recompile itself. If you need to decompile an entire assembly, you would likely have a lot of work left to get it to a compilable state.

Unfortunately, decompilation is not perfect. Some more complex language constructs, like C#'s dynamic, are not yet supported and can result in somewhat garbled output. You can still get the general algorithm through the clutter, but it certainly wouldn't work if you just wanted to copy some code.

IDE integration. There was an early attempt for Visual Studio, though it appears to have been abandoned. There also doesn't seem to be any integration for Xamarin (when'd that happen?). However, the developers of ILSpy also created SharpDevelop, and recent news indicates they are planning SharpDevelop integration.


If you want other options, there's also dotPeek and JustDecompile. They do claim to have Visual Studio extensions, and might be more polished with some well-known companies behind them. I have not had a need to use either of them (ILSpy has worked for everything I needed), but they may suit your requirements better.

  • Great explanation, thanks! The C++/CLI is an option I can live without, and exporting to entire project seems a cool feature. The Xamarin Studio is somewhat of a recent player, as MonoDevelop (its former self) was of unclear fate a few years back. The SharpDevelop IDE support can drag me into getting to know that IDE too. I think the garbled output is always an issue with decompiling, and I doubt someone would use one-to-one decompiled code in an actual project. The ILSpy then seems a sufficient tool for my needs. – Ivaylo Slavov Feb 7 '14 at 22:59
10

There is another tool developed by telerik - JustDecompile. It works really well, and has all the features of .NET Reflector and then some. (Including a visual studio extension). It's also free, which is nice. I've used it every since it came out and its quite nice.

One of my favorite features, is located under the tools menu "Create Project", it takes the assembly and build a csproj file out of it.

Just Decompile With Mysql data provider

6

I personally am a big fan of dotPeek from Jetbrains as it ties in very nicely with Resharper and has some additional features to pull in .pdb:

enter image description here

  • 1
    Welcome to Software Recommendations, and thanks for participating! While a good start, unfortunately your post does not contain enough information to be considered a high quality answer. Please read our discussion on what makes an answer high quality to see if you can incorporate some of these improvements into your answer. Especially, you need to point out how your recommended product matches the OPs requirements. Some pointers to stability, reliability, and performance might also be nice ;) Thanks! – Izzy May 27 '14 at 14:55

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.