Module project
Expand description
Multi-assembly project management and loading.
The project module provides the crate::project::CilProject container for managing
collections of related .NET assemblies with automatic dependency resolution and
cross-assembly analysis capabilities. It includes both legacy APIs and the new
crate::project::ProjectLoader builder-style API.
§Key Components
project::CilProject- Main multi-assembly containerproject::ProjectLoader- Builder-style loading API with flexible configurationproject::ProjectResult- Unified result type with loading statisticsProjectContext- Internal coordination for parallel loading (crate-internal)
§Examples
§New ProjectLoader API (Recommended)
use dotscope::project::ProjectLoader;
// Single assembly loading
let result = ProjectLoader::new()
.primary_file("MyApp.exe")?
.build()?;
// Multi-assembly with dependencies
let result = ProjectLoader::new()
.primary_file("MyApp.exe")?
.with_dependency("MyLib.dll")?
.auto_discover(true)
.build()?;
// With automatic discovery
let result = ProjectLoader::new()
.primary_file("MyApp.exe")?
.with_search_path("./dependencies")?
.auto_discover(true)
.build()?;
println!("Loaded {} assemblies", result.success_count());§Legacy CilProject API
use dotscope::project::CilProject;
use dotscope::CilObject;
use std::path::Path;
let project = CilProject::new();
let assembly = CilObject::from_path(Path::new("MyApp.exe"))?;
project.add_assembly(assembly, true)?;Multi-assembly project container and management system.
This module provides the crate::project::CilProject container for managing collections of related
.NET assemblies with automatic dependency resolution, cross-assembly type resolution,
and unified analysis capabilities. It serves as the foundation for comprehensive
multi-assembly .NET project analysis.
§Architecture
The CilProject system provides several layers of functionality:
- Assembly Management: Centralized loading and storage of multiple assemblies
- Identity Management: Assembly identification using comprehensive identity system
- Cross-Assembly Access: Direct iteration and querying across loaded assemblies
- Primary Assembly Tracking: Identification of the main entry point assembly
§Key Components
§Core Container
crate::project::CilProject- Main multi-assembly container and coordinator- Assembly storage using
crate::metadata::identity::AssemblyIdentityas primary key - Primary assembly tracking for entry point identification
§Loading and Resolution
- Multiple assembly loading strategies via
crate::project::ProjectLoader - Automatic dependency discovery and resolution during loading
- Cross-assembly type registry linking for unified analysis
§Usage Examples
§New ProjectLoader API (Recommended)
use dotscope::project::ProjectLoader;
// Basic single assembly loading
let result = ProjectLoader::new()
.primary_file("MyApp.exe")?
.build()?;
// Multi-assembly with explicit dependencies
let result = ProjectLoader::new()
.primary_file("MyApp.exe")?
.with_dependency("MyLib.dll")?
.with_dependency("System.Core.dll")?
.build()?;
// With automatic discovery
let result = ProjectLoader::new()
.primary_file("MyApp.exe")?
.with_search_path("./dependencies")?
.auto_discover(true)
.build()?;
let project = &result.project;
println!("Loaded {} assemblies", result.success_count());§Manual Assembly Loading
use dotscope::project::CilProject;
use dotscope::CilObject;
use std::path::Path;
let project = CilProject::new();
// Manually load assemblies and add to project
let main_assembly = CilObject::from_path(Path::new("MyApp.exe"))?;
let lib_assembly = CilObject::from_path(Path::new("MyLib.dll"))?;
project.add_assembly(main_assembly, true)?;
project.add_assembly(lib_assembly, false)?;
// Query the project
println!("Loaded {} assemblies", project.assembly_count());
for (identity, assembly) in project.iter() {
println!("Assembly: {} has {} types", identity.name, assembly.types().len());
}Modules§
- context
- Project context for coordinating multi-assembly parallel loading.
Structs§
- CilProject
- Multi-assembly project container with dependency management and cross-assembly resolution.
- Project
Loader - Builder for creating and loading CilProject instances with flexible dependency management.
- Project
Result - Result of a project loading operation.
- Version
Mismatch - A version mismatch between a required and actual assembly version.