This articles gives an overview of 5 free .NET Decompilers. We are focusing only on free tools that you can run for free in both non-commercial and commercial environments.
1. Introduction
In this article, we are giving an overview of a selection of FREE .NET Decompilers available today. We focus only on completely free full-versions tools, that can be run for free in both non-commercial and commercial environments. If a software engineer invests time and effort in learning and building skills with some tool at home that is free only for a non-commercial environment, and then in his workplace finds that the company is not planning to buy that particular tool, it is wasted time and effort.
1.1. Tools Tested
Here is a list of free .NET Decompilers that caught our attention:
- Ildasm.exe (comes with Visual Studio 2022)
- Telerik JustDecompile (https://www.telerik.com/products/decompiler.aspx )
- dnSpyEx (https://github.com/dnSpyEx/dnSpy/releases )
- ILSpy (https://github.com/icsharpcode/ILSpy/releases )
- JetBrains dotPeek (https://www.jetbrains.com/decompiler/ )
2. Test Application
In order to test decompilers, we created a small C#11/.NET7 project consisting of 2 assemblies. Here is what the solution looks like:
And here is the original code:
namespace AlphaAssembly
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine(Resource1.HW);
A a2=new A2();
a2.PrintMessage();
A a3 = new A3();
a3.PrintMessage();
B b2 = new B2();
b2.PrintMessage();
B b3 = new B3();
b3.PrintMessage();
}
}
public class A
{
public virtual void PrintMessage()
{
Console.WriteLine(Resource1.HWA);
}
}
public class A2:A
{
public override void PrintMessage()
{
Console.WriteLine(Resource1.HWA2);
}
}
public class A3 : A
{
public override void PrintMessage()
{
Console.WriteLine(Resource1.HWA3);
}
}
namespace BetaAssembly
public class B
{
public virtual void PrintMessage()
{
Console.WriteLine("Hello World from B");
}
}
public class B2 : B
{
public override void PrintMessage()
{
Console.WriteLine("Hello World from B2");
}
}
public class B3 : B
{
public override void PrintMessage()
{
Console.WriteLine("Hello World from B3");
}
}
3. Ildasm.exe
3.1. Details
3.2. Overview
You can start it from the command line:
Basic assembly view:
And here is the IL code of AlphaAssembly.A.PrintMessage()
method:
And here is Metadata info view:
3.3. Impressions
- License is not free, but it comes with Visual Studio, so most .NET developers will have it
- Very basic functionality, almost at the level of “Proof of concept”
- Just enable IL viewing, no decompiling into C# code
4. Telerik JustDecompile
4.1. Details
4.2. Overview
When I started the app and tried to load my AlphaAssembly.dll, I got a very unpleasant window:
It wanted me to point it to .NET 7. Here is how I resolved it:
Here is the basic assembly view:
Here is class AlphaAssembly.A
in IL:
Here is class AlphaAssembly.A
in C#:
When we tried to reverse engineer BetaAssembly
into C# project, we got this:
4.3. Impressions
- It seems that this app is no longer maintained. It does not know how to handle .NET 7.
- It can provide still useful decompiling to basic C# code on the file level.
- Options present are functional but limited. Not so many fancy tools/options you can see in other products.
- Strange for such a big name like “Telerik” that this app is in such bad shape. They advertise themselves as “Fastest Decompiler. 10 times faster than competitors.”, but in reality, it looks like an abandoned app.
5 dnSpyEx
5.1 Details
- Product: dnSpyEx (continuation of dnSpy)
- Company: OpenSource
- Website: https://github.com/dnSpyEx/dnSpy
- Platforms: Windows
- License: Licensed under GPLv3.
- Note: GitHub: dnSpyEx is a unofficial continuation (fork) of the dnSpy project
5.2 Overview
Here is the basic assembly view:
Here is class AlphaAssembly.A in IL:
Here is class AlphaAssembly.A in C#:
I was looking if I can reverse engineer BetaAssembly.dll into C# project but didn’t see that is possible.
Another nice thing is that it can show you PE format headers for the file/assembly:
Fancy thing is that you can DEBUG assembly even if you do not have the source code. Here is a screenshot where we put a breakpoint into reverse-engineered code and run the assembly up to a breakpoint.
This is a really fancy thing. Especially for the reverse engineering of some applications. You can monitor the state of variables in the debugger.
You can decompile into C# or VB.NET if you like.
5.3 Impressions
- Looks like a nice and stable Decompiler.
- Really liked the PE format headers viewer.
- Debugging is a really fancy feature.
- Some people will like the “decompile to VB.NET” feature, which many other decompilers do not offer.
6. ILSpy
6.1. Details
6.2. Overview
Here is the basic assembly view:
Here is class AlphaAssembly.A
in IL:
Here is class AlphaAssembly.A
in C#:
Very fancy thing is that you can choose even the flavor/version of C# you want to see. That can be very interesting.
When we tried to reverse engineer BetaAssembly
into C# project, and it worked:
But we were not able to build the project right away. We got some build errors.
Another nice thing is that it can show you PE format headers for the file/assembly. Just they hide everything under the generic name “Metadata
”.
6.3. Impressions
- It looks like the project is regularly maintained and receives support from Microsoft.
- Very fancy decompiling into a specific version of C#. I like that a lot.
- Really liked the PE format headers viewer.
- Reverse engineering into VS project is nice, it will probably work with some manual fine-tuning.
7. JetBrains dotPeek
7.1. Details
7.2. Overview
Here is the basic assembly view:
Here is class AlphaAssembly.A
in IL:
Here is class AlphaAssembly.A
in C#:
Very fancy thing is that you can choose a Low-level/high-level version of C# you want to see. That can be very interesting.
When we tried to reverse engineer BetaAssembly
into C# project, and it worked:
But we were not able to build the project right away. We got some build errors.
Then I looked into the project file:
Looks strange, it seems it created a .NET Framework style project with version 7.0. Who knows what happened here? But that is not usable.
Another nice thing is that it can show you PE format headers for the file/assembly. Just they hide everything under the generic name “Metadata
”.
It can create some nice dependency diagrams.
Another nice feature is that when you hover over some IL instruction, you get some hints about that instruction.
7.3. Impressions
- Feels really good, like a professional application with many navigation options.
- Very fancy decompiling into Low-level/High-level of C#. I like that a lot.
- Really liked the PE format headers viewer.
- Reverse engineering into VS project had problems, which is strange for such a big name as JetBrains.
- Dependency diagrams are a nice addition, they can be nice for documenting projects.
8. Conclusion
My personal favorite is:
If you are looking for a stable, feature-rich, nice graphical interface, and well-maintained application, dotPeek is your choice. That is the only .NET Decompiler you will ever need, and you can use it freely at home and at any workplace you will be working.
However, the other application that left a good impression is ILSpy (https://github.com/icsharpcode/ILSpy/releases ). It enabled decompiling into the selected version of C#, so it can be useful in analyzing and comparing different versions of the C# language.
If you want to debug a .NET application without the source code, the only Decompiler that offers that is dnSpyEx (https://github.com/dnSpyEx/dnSpy/releases ).
But of course, preferences and opinions differ, so everyone is entitled to choose his or her own favorite tool and use it at will.
9. References
10. History
- 1st March, 2023: Initial version