Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / MSIL
Article

.NET – 5 Free Decompilers

Rate me:
Please Sign up or sign in to vote.
4.96/5 (36 votes)
2 Mar 2023CPOL6 min read 55.8K   53   23
Overview of 5 free .NET Decompilers
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:

  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

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

Image 1

And here is the original code:

C#
//======================================
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:

Image 2

Basic assembly view:

Image 3

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

Image 4

And here is Metadata info view:

Image 5

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:

Image 6

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

Image 7

Here is the basic assembly view:

Image 8

Here is class AlphaAssembly.A in IL:

Image 9

Here is class AlphaAssembly.A in C#:

Image 10

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

Image 11

Image 12

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:

Image 13

Here is class AlphaAssembly.A in IL:

Image 14

Here is class AlphaAssembly.A in C#:

Image 15

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:

Image 16

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.

Image 17

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.

Image 18

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:

Image 19

Here is class AlphaAssembly.A in IL:

Image 20

Here is class AlphaAssembly.A in C#:

Image 21

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

Image 22

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

Image 23

Image 24

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

Image 25

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

Image 26

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:

Image 27

Here is class AlphaAssembly.A in IL:

Image 28

Here is class AlphaAssembly.A in C#:

Image 29

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.

Image 30

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

Image 31

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

Image 32

Then I looked into the project file:

Image 33

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

Image 34

It can create some nice dependency diagrams.

Image 35

Image 36

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

Image 37

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Serbia Serbia
Mark Pelf is the pen name of just another Software Engineer from Belgrade, Serbia.
My Blog https://markpelf.com/

Comments and Discussions

 
QuestionVersions and dates when reviewed Pin
James H21-Dec-23 1:22
James H21-Dec-23 1:22 
PraiseRe: Versions and dates when reviewed Pin
Mark Pelf 25-Dec-23 0:19
mvaMark Pelf 25-Dec-23 0:19 
Question.NET 7 decompiler Pin
IssamTP8-Mar-23 22:42
IssamTP8-Mar-23 22:42 
AnswerRe: .NET 7 decompiler Pin
Mark Pelf 8-Mar-23 23:15
mvaMark Pelf 8-Mar-23 23:15 
QuestionRe: .NET 7 decompiler Pin
IssamTP14-Mar-23 0:11
IssamTP14-Mar-23 0:11 
AnswerRe: .NET 7 decompiler Pin
trønderen14-Mar-23 0:55
trønderen14-Mar-23 0:55 
GeneralRe: .NET 7 decompiler Pin
IssamTP14-Mar-23 4:31
IssamTP14-Mar-23 4:31 
AnswerRe: .NET 7 decompiler Pin
Mark Pelf 14-Mar-23 1:29
mvaMark Pelf 14-Mar-23 1:29 
QuestionGeneral Question about Decompiling .NET Pin
RunDosRun6-Mar-23 20:36
RunDosRun6-Mar-23 20:36 
AnswerRe: General Question about Decompiling .NET Pin
Mark Pelf 6-Mar-23 20:56
mvaMark Pelf 6-Mar-23 20:56 
GeneralRe: General Question about Decompiling .NET Pin
RunDosRun7-Mar-23 23:52
RunDosRun7-Mar-23 23:52 
QuestionObfuscators Pin
fcav6-Mar-23 11:08
fcav6-Mar-23 11:08 
AnswerRe: Obfuscators Pin
Mark Pelf 6-Mar-23 18:17
mvaMark Pelf 6-Mar-23 18:17 
GeneralRe: Obfuscators Pin
fcav7-Mar-23 10:53
fcav7-Mar-23 10:53 
SuggestionDecompiling VB.NET assemblies Pin
Christian Woltering6-Mar-23 4:52
Christian Woltering6-Mar-23 4:52 
Questionmy vote of 5 Pin
Southmountain3-Mar-23 4:02
Southmountain3-Mar-23 4:02 
GeneralMy vote of 5 Pin
Member 137041433-Mar-23 0:52
Member 137041433-Mar-23 0:52 
QuestionWhat about plugins? Pin
acblood2-Mar-23 8:18
acblood2-Mar-23 8:18 
PraiseRe: What about plugins? Pin
Mark Pelf 2-Mar-23 11:49
mvaMark Pelf 2-Mar-23 11:49 
PraiseThe clear winner is ... Pin
Christian Woltering1-Mar-23 0:16
Christian Woltering1-Mar-23 0:16 
PraiseRe: The clear winner is ... Pin
Mark Pelf 1-Mar-23 0:39
mvaMark Pelf 1-Mar-23 0:39 
GeneralRe: The clear winner is ... Pin
Fred Kreppert1-Mar-23 10:31
Fred Kreppert1-Mar-23 10:31 
PraiseRe: The clear winner is ... Pin
Mark Pelf 1-Mar-23 17:07
mvaMark Pelf 1-Mar-23 17:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.