dotnetdll
A Rust library for reading and writing .NET assembly metadata (DLL/EXE files).
Implements the ECMA-335 (CLI) standard for .NET metadata manipulation.
Status: Pre-1.0. Core functionality is complete and tested, but the API may evolve before the 1.0 release.
Features
- Parse .NET PE files into structured metadata
- Generate .NET assemblies from scratch programmatically
- Inspect types, methods, fields, IL bytecode, custom attributes, and resources
- Type-safe navigation using typed indices instead of raw integers
- Ergonomic macros for constructing types, signatures, and IL code
Quick Start
Add this to your Cargo.toml:
[]
= "0.1"
Reading a DLL
use *;
Writing a DLL
use *;
Documentation
- API Documentation - Comprehensive API reference
- Examples - Working examples including a DLL dumper and mini-assembler
Architecture
The library is organized into layers:
resolution- High-level API withResolution::parse()andResolution::write()resolved- Semantic types likeTypeDefinition,Method,Instructionbinary- Low-level ECMA-335 binary structuresdll- PE file parsing
Most users only need resolution and resolved.
Examples
The repository includes example projects you can learn from:
bash
# Inspect a DLL
cargo run -p dump-dll -- path/to/Some.dll
# Mini assembler demo
cargo run -p smolasm -- --help
Compatibility
- Rust 1.85.1+ (Rust 2024 edition)
- Supports PE32 and PE64 formats
- Focuses on metadata manipulation, not runtime execution
- Tested against .NET 5+ assemblies
Contributing
Contributions welcome! Areas where help is especially appreciated:
- Documentation improvements
- Additional examples
- Bug reports and fixes
License
GPL-3.0-or-later. See LICENSE.