DotNetPELib Version 2.1
The DotNetPELib library may be used to generate and/or read the contents of .NET assemblies. It has support for most aspects of the ECMA-335 standard for CIL assemblies, which specifies the formats used in .NET 2.0, but may also be used for later versions of .NET. The reference MSIL C compiler
exercises most aspects of the library
Some of the features of the library include:
- Memory management
- Ability to create an arbitrary container heirarchy consisting of multiple nested namespaces and classes
- Support for loading and referencing members of external assemblies
- Support for finding things in external assemblies
- Support for iterating through all definitions in external assemblies
- Support for C# enumerations
- Support for C#-style 'varargs'
- Support for C# arrays. Multidimensional arrays aren't 100% supported by the library but can be added after the fact.
- Support for all MSIL instructions and data types, including strings
- Support for 'boxed' data types
- Support for PInvokes
- Various optimizations of the MSIL code, and sanity checks for use diagnosing generated code
- Support for either binary output, or ILASM source files
- Support for reading Strong Name key files and signing assemblies
- Support for analyzing Custom Attributes found in an external assembly
- Support for creating and importing properties
- Support for setting packing and size of classes, and explicit offsets of fields (can support union-like constructs)
- Written using features of C++11
- Documentation in HTML format
This library is hosted on Github.
A CodeProject article written by Alexandre Bencz discusses the library in some depth. There is also an example program called 'test.exe' distributed with the library, which shows how to make several small executables using the library.
This library is released on April 2, 2017 at version 2.1