none
Use of ILASM.exe RRS feed

  • Question

  • MSDN Says "The text file produced by Ildasm.exe can be used as input to the MSIL Assembler (Ilasm.exe). This is useful, for example, when compiling code in a programming language that does not support all the runtime metadata attributes." First line is clear. But I did not understand the last line. An real time example might help me...
    - Rajesh K http://thoughtsontechies.blogspot.com/
    Tuesday, April 26, 2011 5:31 AM

Answers

  • Hello Rajesh, depending on the .NET language (C#, VB, J#, ...) the IL Code generated is different. There are some features that one language have and another may not. The only language wich have support for almost all the metadata .NET features is th IL a.k.a. MSIL. Then, some programs can take advantage of ILDAsm and ILAsm to disassemble-modify-assemble to get full support of .NET metadata addition/modification. The most important programs that use this pattern are the Obfuscators.

    If you are interested about IL code, you can take a look to this two books:

    - Inside Microsoft® .NET IL Assembler (Microsoft Press, 2002):

        http://www.microsoft.com/MSPress/books/reviews/default.aspx?id=5771&isbn=9780735615472

    - Expert .NET 2.0 IL Assembler (Apress, 2006):

        http://www.apress.com/microsoft/net-framework/9781590596463

    Those books helps me a lot to understand the .NET platform and the MSIL. The author, Serge Lidin is the person who wrote ilasm and ildasm programs and (between others) defined the .NET CLR metadata.

    Hope this helps,

    Miguel.






    Tuesday, April 26, 2011 11:47 AM

All replies

  • Hi,

    The example in MSDN is not very useful scenario. But the ildasm-ilasm round-trip could be used for several other reasons:

    • You want to manipulate the code and you don't have sources. For example, you have an assembly that has a class marked as sealed (C#) or final (VB.Net) and you want to inherit from it. You can disassemble, remove the property and then reassemble it again.
    • Adding a debbuging information or even some code without loosing mapping with original source file. See this article.
    • Signing unsigned third-party assemplies. See example here.
    • You can disassemble several modules to reassemble them into one module.

    Some other uses could be found. Hope it was helpful.


    Best Regards,
        Eugene

    Please mark the response as answers if it solves your question or vote as helpful if you find it helpful
    www.emightgen.com
    Tuesday, April 26, 2011 11:14 AM
  • Hello Rajesh, depending on the .NET language (C#, VB, J#, ...) the IL Code generated is different. There are some features that one language have and another may not. The only language wich have support for almost all the metadata .NET features is th IL a.k.a. MSIL. Then, some programs can take advantage of ILDAsm and ILAsm to disassemble-modify-assemble to get full support of .NET metadata addition/modification. The most important programs that use this pattern are the Obfuscators.

    If you are interested about IL code, you can take a look to this two books:

    - Inside Microsoft® .NET IL Assembler (Microsoft Press, 2002):

        http://www.microsoft.com/MSPress/books/reviews/default.aspx?id=5771&isbn=9780735615472

    - Expert .NET 2.0 IL Assembler (Apress, 2006):

        http://www.apress.com/microsoft/net-framework/9781590596463

    Those books helps me a lot to understand the .NET platform and the MSIL. The author, Serge Lidin is the person who wrote ilasm and ildasm programs and (between others) defined the .NET CLR metadata.

    Hope this helps,

    Miguel.






    Tuesday, April 26, 2011 11:47 AM