Thursday, February 23, 2012

Decompiling a .NET dll

Today I wanted to decompile a .NET dll. While looking for a way of doing it, it got to my mind that some times back I had a trouble distinguishing "Decompile & Disassemble". Those days the both meant same to me and thought to write a brief explanation about this first.

The traditional explanation of these terms are as follows:
  1. Decompile - To convert assembly language to a high level language. 
  2. Disassemble - To convert machine language to assembly language.
Common Intermediate Language(CIL) is equivalent to assembly language for a CPU. In .NET, dll(Dynamic Link Library) is an assembly which is built up with the CIL code. Assembly is used for deployment, versioning, and security. There are two types of assemblies,
  1. Process assemblies (EXE)
  2. Library assemblies (DLL)
Now hope you all got a clear understanding about these two. So to decompile a .NET dll, I found out this nice open-source .NET assembly browser and decompiler.

It has a lot of nice features,
  • Assembly browsing
  • IL Disassembly
  • Decompilation to C#
  • Saving of resources
  • Save decompiled assembly as .csproj
  • Search for types/methods/properties (substring)
  • Hyperlink-based type/method/property navigation
  • Base/Derived types navigation
  • Navigation history
  • BAML to XAML decompiler
  • Save Assembly as C# Project
  • Find usage of field/method
  • Extensible via plugins (MEF)

To get it to work, please remember that you need to have Microsoft .NET Framework 4 installed in your machine.

Happy Coding.


1 comment:

  1. This information about Decompile and Disassemble really fine. It is good to know about .net new features. So thanks again.
    Ecommerce Web Site Design