I am trying to write an application which loads an assembly and list outs which assemblies this again depends on. This part is working fine using Assembly.LoadFrom(asmPath) and GetReferencedAssemblies().
I would also like to extract some public information from the dll. Mainly I want to find classes which implements certain tags (typically Microsoft.AspNetCore.Mvc.ApiControllerAttribute) and the arguments that these functions have. When I try to call asm.GetTypes(), I get an ReflectionTypeLoadException because Microsoft.AspNetCore.Mvc.Core is not loaded.
Is there a way to load Microsoft.AspNetCore.Mvc.Core using the referenced assembly? I am trying to do this for a lot of dlls, so adding a nuget reference in my "assembly examination program" for all the references is not possible. Or is there a better way to get the information I am looking for?
Aucun commentaire:
Enregistrer un commentaire