Monday, April 23, 2007

* Tool : MSIL Disassembler (Ildasm.exe)

Ildasm is one of the most frequently used tool by .NET community. It comes as part of the .net sdk since the very beginning.

The main purpose of this tool is to convert the portable executable (PE) file into readable and compilable MSIL code.

For beginners let me just explain few things :

  • MSIL : Microsoft Intermediate Language. When you compile your .net source code it gets converted to MSIL which is a platform independent language. The resultant exe or dll which you get contains the MSIL which gets compiled to native code at runtime.
  • PE File : The exe or dll file which you get after compilation of .net source code or MSIL code is called portable executable file which contains MSIL plus metadata about types and external dependencies which make PE an independent,self-describing entity and can be executed by runtime.

Ildasm supports both console and rich UI interface. The rich UI interface is the one most commonly used and is very useful for seeing following contents of an assembly :

  • Types in that assembly with full qualified names.
  • Methods and signatures available in various types.
  • Access modifiers of various types.
  • Version of that assembly.
  • Detecting if its strong named
  • External assemblies to which it references to including their version number.

In console mode Ildasm supports various other advanced options. The output in the console mode can be saved to a file in rtf , text or html format.

The other advanced options supported are :

  • /linenum : includes references to original source files
  • /source : show original source lines as comments
  • /html : produces output in html format.

The unrestricted output file containing MSIL generated by Ildasm can be given as input directly to MSIl Assembler Tool (Ilasm.exe) which will generate PE back again from which MSIL was generated.

Ildasm can also be used to check if the exe or dll file is managed or not. For unmanaged files it displays a message that no valid common language header found.

Add to :    Digg this    Technorati

Other Posts


  1. from where I can download Ilasm.exe


  2. This comment has been removed by the author.

  3. thats already there in FrameworkSDK..u can follow some steps to get into ur tools menu option.To do this, from the Tools menu, select External Tools, click the Add button, and type ILDASM.Click the Browse button at the end of the Command field to navigate to where ILDASM.exe resides (probably either C:\Program Files\Microsoft.Net\FrameworkSDK\Bin\ILDASM.exe or C:\Program Files\Microsoft.Net\FrameworkSDK\v1.1\Bin\ILDASM.exe). Finally, in the Arguments box, click the right-arrow to get a list of variables; select $(TargetPath) for the current executable.
    Now u can view ILDASM into ur tools menu...

    U can also type ildasm nameofdll.dll in command prompt....