This tool is used to convert the PE file which contains the
Microsoft Intermediate Language into a text file, which can be use as input to
the Ilasm.exe tool.
The syntax for using this tool is:
ildasm [options] [PEfilename] [options]
These are some important options available with the tool
Ildasam.exe tool to generate the MSIL code.
Option
|
Description
|
/output=filename
|
This option is used to generate the MSIL file with a
specific filename given.
|
/rtf
|
This option produces the output in the rich text format.
This is new option is available in .Net Framework 2.0
|
/text
|
This option displays the MSIL code in the console window
instead of a file so that we can watch the msil code in the immediate window.
|
/html
|
This option produces the ouput in html format using the
output:filename option set.
|
/?
|
This displays the set of options available with the tool.
|
/bytes
|
It shows the msil code as a hexadecimal code which is easy
to view.
|
/noca
|
This option suppresses the output of custom attributes.
This is new in .Net framework 2.0
|
/pubonly
|
Using this option we can disassemble only the public
members.
|
/source
|
This option shows original lines of code in comments along
with msil which can be easily readable.
|
/visibility:vis[+vis...]
|
Disassembles only types or members with the specified
visibility.
|
/classlist
|
Includes the list of classes defined in the module. This
is new in .net framework 2.0.
|
/noil
|
Suppresses MSIL assembly code output.
|
/stats
|
Includes statistics on the image.
New in the .NET Framework version 2.0.
|
Ildasm.exe only operates on PE files on disk. It does not
operate on files installed in the global assembly cache.
Example 1: To generate the MSIL of .dll in a given file:
ildasm "C:\Documents and Settings\suresh\My
Documents\Visual Studio Projects\Samples\TestClassLibrary\bin\Debug\TestClassLibrary.dll"
/output:mytestfile.il
Example 2: To generate the MSIL using actual source as
comments:
ildasm /source "C:\Documents and Settings\suresh\My
Documents\Visual Studio Projects\Samples\TestClassLibrary\bin\Debug\TestClassLibrary.dll"
Example 3: To generate the source code in graphical
representation:
ildasm /bytes "C:\Documents and Settings\suresh\My
Documents\Visual Studio
Projects\Samples\TestClassLibrary\bin\Debug\TestClassLibrary.dll"
Example 4: To generate a msil out of an .exe:
ildasm Test.exe /output:Test.il