lundi 3 février 2020

How to get a list of classes in a dll without the need for references? c# reflection [duplicate]

I want to get the list of classes in an assembly file like below:

Assembly a = Assembly.LoadFrom(dll);
classesList = a.GetTypes();

This assembly uses other references that I haven't them and during getting the classes that exist in them, this error happens:

Could not load file or assembly 'test.dll Version=1.0.7233.5369, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Actually I want to skip getting those classes that do not exist in the current assembly and just get its own classes. but GetTypes() method doesn't have any skip and it crashes.





Aucun commentaire:

Enregistrer un commentaire