Hey Cory,

On Wed, Apr 28, 2010 at 6:05 AM, Cory Miller <coryjamesmil...@gmail.com> wrote:
> I am using the latest source (0.9.1) and I am trying to analyze code
> that is across multiple assemblies.  Basically I am looking at a class
> (B) that extends another class (A) located in another assembly.  When
> looking at the class (TypeDefinition) I am trying to resolve its
> interfaces (if it has any) and I am getting an exception because it
> cannot locate the other assembly as it is in another directory.
> Before I start, I know the directories of all the assemblies.  Is
> there a way to either A) pre-load all the assemblies so that when I do
> a TypeReference.Resolve() it will look at only the assemblies I have
> loaded?  or B) specify the directories to search when trying to
> resolve a type?

Both A) and B) can be achieved with a custom IAssemblyResolver.

B) is the easiest:

var resolver = new DefaultAssemblyResolver ();
resolver.AddSearchDirectory (my_directory);

var module = ModuleDefinition.ReadModule (my_module, new
ReaderParameters { AssemblyResolver = resolver });

A) is basically the same, except you would have to implement
IAssemblyResolver yourself to return only loaded assemblies.

-- 
Jb Evain  <j...@nurv.fr>

-- 
--
mono-cecil

Reply via email to