How can I view MSIL / CIL generated by C# compiler? Why is it called assembly?

  1. Yes it is, more exactly in the .text section of the PE file (portable executable = *.exe or *.dll). More information can be found here.
  2. The best choice is to use ILSpy (Reflector is no longer free). It’s a free disassembler that can dissassemble your assembly into MSIL but also C#, VB (to some extent). The .NET Framework SDK contains ILDasm, which is the official MSIL dissasembler.
  3. Basically yes. An assembly is a file that contains MSIL code and corresponding metadata. This is not restricted to PE files per se, but all current CLR implementations use them.

If I may recommend a good book on that matter too, it’s Expert .NET 2.0 IL Assembler by Serge Lidin. He’s the guy who designed MSIL.

Leave a Comment