An Introduction To .NET Decompiler

Introduction 

  • .NET decompiler is used to decompile the Libraries, Executables, and more.
dotPeek Tool
  • dotPeek tool is a .NET decompiler. This dotPeek application can decompile different kinds of assembly files, such as -
     
    1. Libraries (.dll)
    2. Executable files (.exe)
    3. Windows 8 metadata files (.winmd)
    4. Archives (.zip)
    5. NuGet packages (.nupkg)
    6. Microsoft Visual Studio Extensions packages (.vsix)
       
      dotPeek tool
       
  • Some exe files produced, like chrome.exe, are not decompiled with the dotPeek tool though.
  • The dotPeek tool is introduced by Microsoft.

Features of .NET Decompiler

 
Decompiles libraries, executables, and more.
 
.NET Decompiler
 
View source code if available
  • If the dll is supported to decompile, the code is downloaded and we can see the dll code. 
dotPeek Tool
 
Show or hide compiler-generated code
  • Sometimes, we want to show or hide the compiler-generated code; then, we use this .NET Decompiler.
  • We can hide our code like in the below image. 
DebuggerHidden
 
Explore running processes 
  •  We can explore the running processes.
 
Add Assembly to Assembly Explorer
 
View IL code in a separate view
  •  We can view intermediate language code (IL code)
IL Viewer
 
We can View IL code as comments to decompile C#
 
View IL code
 
 We can use our preferred color theme
  •  Different 
JetBrains dotPeek
 
Manage assembly lists
  • We can also view the assembly list.
  • Example: We have decompiled the system.Threading.dll. This .dll file has some references which we can view with the help of dotPeek.
Assembly Explorer
 
We can explore assemblies
  •  We can simply explore our .dll  -- these .dll have multiple class and base types.
explore assemblies
 
We can view dependencies between assemblies
 
view dependencies between assemblies
 

Steps for Decompiling the dll

 
Step 1
 
Open the dotPeek application.
 
dotPeek
 
Step 2
 
Browse the file assemblies.
 
Browse file assemblies
 
Step 3
 
View the source code.
 
View source code