This documentation is archived and is not being maintained.

Emitting Dynamic Assemblies

This section describes a set of managed types in the System.Reflection.Emit namespace that allow a compiler or tool to emit metadata and Microsoft intermediate language (MSIL) at run time and optionally generate a portable executable (PE) file on disk. Script engines and compilers are the primary users of this namespace. In this section, the functionality provided by the System.Reflection.Emit namespace is referred to as reflection emit.

The following services are provided by reflection emit:

  • Defines assemblies at run time and then runs and/or saves them to disk.
  • Defines modules in new assemblies at run time and then runs and/or saves them to disk.
  • Defines types at run time, creates instances of these types, and invokes the type's methods.
  • Defines symbolic information for defined modules that can be used by tools such as debuggers and code profilers.

The metadata emit interfaces described in the Metadata API specification (located in the %systemroot%\Microsoft.NET\Framework SDK\Tool Developers Guide\Docs directory) and the Assembly Manifest specification (located in the %systemroot%\Microsoft.NET\Framework SDK\Tool Developers Guide\Docs directory) provide an alternative set of unmanaged APIs for defining metadata. Reflection emit provides stronger semantic error checking and a higher level of abstraction of the metadata than the metadata emit interfaces.

In This Section

Reflection Emit Abstractions
Lists and describes the reflection emit abstractions.
Reflection Emit Scenarios
Describes the core and application scenarios supported by reflection emit.
Security Issues in Reflection Emit
Describes security issues related to creating dynamic assemblies using reflection emit.
Using Reflection Emit
Describes fundamental tasks you can perform using reflection emit.
More Information About Reflection Emit
Describes other documentation related to reflection emit.

Related Sections

Provides an overview of assemblies in the .NET Framework.
System.Reflection.Emit Namespace
Provides reference information about the classes in the System.Reflection.Emit namespace.