Every once in a while a project comes along that requires integrating with a third-party library or working with existing compiled code. On occasion those libraries can come with either poor or no documentation at all. This can make debugging a nightmare. In this case, having a peek at the source code can point you in the right direction or even solve the problem altogether. Believe it or not, there are several solutions available for decompiling .NET code on any budget, including many that are completely free. You can even (gasp!) make changes to the library and re-publish! Here is a look at the options.
Reflector was previously the only solution available for decompiling .NET assemblies. They offer a complete desktop application and an option for Visual Studio integration. I say “previously” because .NET Reflector recently switched to a paid application, which spurred many of the competitor products. Pricing for Reflector starts at $95.
dotPeek is my favorite .NET decompiler application. It has a clean, familiar design and also has many IDE-like features for navigating through the decompiled code. My only complaints are that it only decompiles to C# code at the moment and that it does not allow direct editing of the library. You can however save the code as Visual Studio project and rebuild it on your own. Best of all, it’s free.
JustCompile has many of the same features as dotPeek including the ability to create Visual Studio projects. It is also very fast and provided free of charge. I ended up using JustCompile for a recent project because it is compatible with Reflexil, a plugin that allows you to directly edit the library. It is not as simple as just writing new code, but it is very helpful for situations where you just need to make small changes and don’t want to rebuild. (Note: Reflexil also works with Reflector, but JustCompile is the only free application that it supports.)
CodeReflect is a decompile-only product, meaning that it does not provide any of the Visual Studio project features of some of the other options. It has a very simple interface and is also free of charge. CodeReflect can decompile .NET code into either VB.NET or C#, whichever you prefer.
I have not used ILSpy, but I wanted to include it in the roundup since it is the only open source .NET decompiler. ILSpy can decompile to either VB.NET or C# and save as a project in C#. If you are a developer who is curious about decompiling, you can check out the source code to learn how it all works.
Thanks for reading. Do you have a favorite .NET decompiler that is not on the list? Feel free to leave a comment!