Have a look at Mono Cecil.
This library has the capability to 'reflect' (not a very good name for it) on the actual assembly image to do analysis. This assumes that you would be willing to compile down to a 'big' assembly in order to run the dependency analysis using Mono.Cecil.
Edit In fact, you might simply use Cecil to copy the 'big' assembly while filtering out parts of it. That way, you'll not have much of the complexity of compiling the separate assemblies; Look at CecilRoundtrip sample for an example of how to roundtrip (read -> manipulate -> save) assemblies in Cecil.
I have previously published quite extensive examples of how to use Mono Cecil for 'advanced' searches (static call tree search, in essence):
The absolute bare minimum that would be most useful to you would probably be:
var types = assemblies
.SelectMany(assembly => assembly.MainModule.Types.Cast<TypeDefinition>());
var dependencies = types.ToDictionary(
key => key,
typedef => new HashSet<string>(typedef.Methods.Cast<MethodDefinition>()
.Where(method => null != method.Body) // ignore abstracts and generics
.SelectMany(method => method.Body.Instructions.Cast<Instruction>())
.Select(instr => instr.Operand)
.OfType<TypeReference>().Distinct()
// .Where(type => !type.Namespace.StartsWith("System"))
.Select(type => type.Name)));
foreach (var entry in dependencies)
{
Console.WriteLine("{0}\t{1}", entry.Key.Name, string.Join(", ", entry.Value.ToArray()));
}
Note the commented line optionally filters out things from the framework (System.String
, System.Char
etc.).
This will list required types per declared type. To list types used, simply tag on the lookup to assembly name:
.Select(type => type.Module.Assembly.Name.Name)));
Sample output of the first kind (types required):
SegmentSoortKenmerk SegmentSoortKenmerk
OperatorValue
Koppelpad Koppelpad, CodeLeidendVolgend
RedenWaarschuwing
RelExceptions
GecontroleerdDocument GecontroleerdDocument, GecontroleerdDocument[]
OwiExtraKenmerk OwiExtraKenmerk, Gegeven, BackofficeRelatie
Entiteit Entiteit, SleutelSysteemObject[], EniteitType
Similar query but using the assembly name lookup:
SegmentSoortKenmerk Lspo.Business
OperatorValue
Koppelpad Lspo.Business
RedenWaarschuwing
RelExceptions
GecontroleerdDocument Lspo.Business
OwiExtraKenmerk Lspo.Business
Entiteit Lspo.Business