The following command causes the metadata and disassembled code for the PE file MyHello.exe to display in the Ildasm.exe default GUI.
The following command disassembles the file MyFile.exe and stores the resulting MSIL Assembler text in the file MyFile.il.
ildasm MyFile.exe /output:MyFile.il
The following command disassembles the file MyFile.exe and displays the resulting MSIL Assembler text to the console window.
If the file MyApp.exe contains embedded managed and unmanaged resources, the following command produces four files: MyApp.il, MyApp.res, Icons.resources, and Message.resources:
ildasm MyApp.exe /output:MyApp.il
The following command disassembles the method MyMethod within the class MyClass in MyFile.exe and displays the output to the console window.
ildasm /item:MyClass::MyMethod MyFile.exe /text
In the previous example, there could be several methods named MyMethod with different signatures. The following command disassembles the instance method MyMethod with the return type of void and the parameter types int32 and string.
ildasm /item:"MyClass::MyMethod(instance void(int32,string)" MyFile.exe /text
Note: |
|---|
In the .NET Framework versions 1.0 and 1.1, the left parenthesis that follows the method name must be balanced by a right parenthesis after the signature: MyMethod(instance void(int32)). In the .NET Framework version 2.0 the closing parenthesis must be omitted: MyMethod(instance void(int32). |
To retrieve a static method (Shared method in Visual Basic), omit the keyword instance. Class types that are not primitive types like int32 and string must include the namespace and must be preceded by the keyword class. External types must be preceded by the library name in square brackets. The following command disassembles a static method named MyMethod that has one parameter of type AppDomain and has a return type of AppDomain.
ildasm /item:"MyClass::MyMethod(class [mscorlib]System.AppDomain(class [mscorlib]System.AppDomain)" MyFile.exe /text
A nested type must be preceded by its containing class, delimited by a forward slash. For example, if the MyNamespace.MyClass class contains a nested class named NestedClass, the nested class is identified as follows: class MyNamespace.MyClass/NestedClass.