Mono.Cecil

Cecil is a library written by Jb Evain to generate and inspect programs and libraries in the ECMA CIL format. With Cecil, you can load existing managed assemblies, browse all the contained types, modify them on the fly and save back to the disk the modified assembly.

Today it is used by the Mono Debugger, the bug-finding and compliance checking tool Gendarme and many other tools.

Mailing List

There is a Google Group to discuss everything Cecil related: mono-cecil

Release Notes and Development Updates

Visit jbevain/cecil on GitHub to get the latest updates.

Using Cecil

Check the Cecil wiki for some usage examples.

Download

Get the Mono.Cecil NuGet package.

Documentation

You can visit, and even contribute, to Cecil’s wiki.

Differences with Reflection/Reflection.Emit

Reflection and Reflection.Emit only expose a subset of all the features in a CLI image. Since we want to remain compatible with the Microsoft implementation, we can not add or change the behavior of this library to be more complete.

Two big differences are that:

  • Cecil has support for extracting the CIL bytecodes.
  • Cecil does not need to load the assembly or have compatible assemblies to introspect the images.