What is CCI Metadata?

CCI Metadata

The Common Compiler Interface (CCI) is a collection of frameworks for working with .NET source code, assemblies, and modules. In part, CCI supports a more efficient version of the functionality provided by System.Reflection, System.Reflection.Emit, and System.CodeDom. However, CCI goes beyond those components to provide a unified framework for static analysis and rewriting of assembly metadata and MSIL. CCI supports a broad range of scenarios, including:.
  • Compilers, which start with source code and transform it to .NET assemblies and modules.
  • Static analysis tools, which analyze the contents of .NET assemblies.
  • Rewriting tools, which add code or metadata to assemblies or modify existing code or metadata.
CCI consists of two components, CCI Metadata and CCI AST and Code. Both components represent a .NET portable executable (PE) file’s metadata and method bodies as an object model. Applications can then use the object models to work with the contents of the file.
  • CCI Metadata supports applications that work primarily or solely with metadata. You can use CCI Metadata to work with method bodies, but only as flat lists of Microsoft intermediate language (MSIL) instructions.
  • CCI Code and AST API is an extension of CCI Metadata that simplifies working with method bodies. The CCI Code and AST API represents method bodies with a language-independent structured object model that is similar to source code structure. This model is usually easier to work with than MSIL, especially for complex code.
The two CCI components are separate CodePlex projects. This wiki is devoted to CCI Metadata and is of interest to developers who want to implement CCI-based applications that work primarily with metadata.
Examples of how CCI Metadata can be used include:
  • Analyze .NET assemblies to look for poor programming practices and potential bugs. FxCop uses an earlier version of CCI to perform this task.
  • Read a DLL’s metadata and use it, along with associated documentation comments, to create an API reference help file for the DLL. SandCastle uses an earlier version of CCI to perform this task.
  • Insert simple instrumentation or tracing code in method bodies.
  • Perform language-agnostic error checking. One example is the static checker in Code contracts tool.
If you want to implement a CCI-based application that works extensively with method bodies, see the CCI Code and AST API project.

Last edited Dec 15, 2009 at 2:57 PM by Guy_Smith, version 3


No comments yet.