.NET - 5 Free Decompilers

Abstract: In this article, we are giving an overview of 5 free .NET Decompilers. We focus only on free tools that you can run for free in 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 founds that the company is not planning to buy that particular tool, it is a wasted time and effort.

1.1 Tools Tested

Here is a list of free .NET Decompilers that caught our attention:

  1. Ildasm.exe (comes with Visual Studio 2022)
  2. Telerik JustDecompile (https://www.telerik.com/products/decompiler.aspx )
  3. dnSpyEx (https://github.com/dnSpyEx/dnSpy/releases )
  4. ILSpy (https://github.com/icsharpcode/ILSpy/releases )
  5. JetBrains dotPeek (https://www.jetbrains.com/decompiler/ )

2 Test application

To test decompilers, we created a small C#11/.NET7 project consisting of 2 assemblies. Here is what the solution looks like:

.NET - 5 Free Decompilers

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:

.NET - 5 Free Decompilers

Basic assembly view

.NET - 5 Free Decompilers

And here is the IL code of AlphaAssembly.A.PrintMessage() method:

.NET - 5 Free Decompilers

And here is the Metadata info view:

.NET - 5 Free Decompilers

3.3 Impressions

  • The 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:

.NET - 5 Free Decompilers

It wanted me to point it to .NET 7. Here is how I resolved it:

.NET - 5 Free Decompilers

Here is the basic assembly view:

.NET - 5 Free Decompilers

Here is class AlphaAssembly.A in IL:

.NET - 5 Free Decompilers

Here is class AlphaAssembly.A in C#:

.NET - 5 Free Decompilers

When we tried to reverse engineer BetaAssembly into a C# project, we got this:

.NET - 5 Free Decompilers

.NET - 5 Free Decompilers

4.3 Impressions

  • It seems that this app is no longer maintained. It does not know how to handle .NET 7.
  • It can still provide 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 as the “Fastest Decompiler. 10 times faster than competitors.” 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 an unofficial continuation (fork) of the dnSpy project

5.2 Overview

Here is the basic assembly view:

.NET - 5 Free Decompilers

Here is class AlphaAssembly.A in IL:

.NET - 5 Free Decompilers

Here is class AlphaAssembly.A in C#:

.NET - 5 Free Decompilers

I was looking if I can reverse engineer BetaAssembly.dll into a 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:

.NET - 5 Free Decompilers

The 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 to a breakpoint.

.NET - 5 Free Decompilers

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 it into C# or VB.NET if you like.

.NET - 5 Free Decompilers

5.3 Impressions

  • Looks like a nice and stable Decompiler.
  • I 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:

.NET - 5 Free Decompilers

Here is class AlphaAssembly.A in IL:

.NET - 5 Free Decompilers

Here is class AlphaAssembly.A in C#:

.NET - 5 Free Decompilers

The very fancy thing is that you can choose even the flavor/version of C# you want to see. That can be very interesting.

.NET - 5 Free Decompilers

When we tried to reverse engineer BetaAssembly into a C# project, it worked:

.NET - 5 Free Decompilers

.NET - 5 Free Decompilers

But we were not able to build the project right away. We got some build errors.

.NET - 5 Free Decompilers

Another nice thing is that it can show you PE format headers for the file/assembly. They hide everything under the generic name “Metadata”

.NET - 5 Free Decompilers

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.
  • I really liked the PE format headers viewer.
  • Reverse engineering into VS projects 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:

.NET - 5 Free Decompilers

Here is class AlphaAssembly.A in IL:

.NET - 5 Free Decompilers

Here is class AlphaAssembly.A in C#:

.NET - 5 Free Decompilers

The 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.

.NET - 5 Free Decompilers

When we tried to reverse engineer BetaAssembly into a C# project, it worked:

.NET - 5 Free Decompilers

But we were not able to build the project right away. We got some build errors.

.NET - 5 Free Decompilers

Then I looked into the project file:

.NET - 5 Free Decompilers

It 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. They hide everything under the generic name “Metadata”.

.NET - 5 Free Decompilers

It can create some nice dependency diagrams.

.NET - 5 Free Decompilers

.NET - 5 Free Decompilers

Another nice feature is that when you hover over some IL instruction, you get some hints about that instruction.

.NET - 5 Free Decompilers

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.
  • I 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 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#, which 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 can choose their favorite tool and use it at will.

9 References

  1. https://learn.microsoft.com/en-us/dotnet/framework/tools/ildasm-exe-il-disassembler
  2. https://www.telerik.com/products/decompiler.aspx
  3. https://github.com/dnSpyEx/dnSpy
  4. https://github.com/icsharpcode/ILSpy#ilspy-------
  5. https://www.jetbrains.com/decompiler/


Recommended Free Ebook
Similar Articles