An assembly may consist of several modules, so in reality it does not have a place as such. The main build module has a location, though:
AssemblyDefinition assembly = ...;
ModuleDefinition module = assembly.MainModule;
string fileName = module.FullyQualifiedName;
So you can write something along the line:
public IEnumerable<string> GetAssembliesFromInheritance (TypeDefinition type)
{
while (type != null) {
yield return type.Module.FullyQualifiedName;
if (type.BaseType == null)
yield break;
type = type.BaseType.Resolve ();
}
}
Or any other option that you like more.
source
share