0

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.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Mr Bitmap
  • 211
  • 4
  • 20
  • Refre This You get the Ans:https://stackoverflow.com/questions/1315665/c-list-all-classes-in-assembly – Bibin Feb 03 '20 at 10:10
  • @Bibin This link that you mentioned refers to a condition that someone wants to get a list of classes in its own assembly, but I want to load an assembly that isn't in my project. – Mr Bitmap Feb 03 '20 at 10:17
  • 2
    Check out the next answer after the accepted one in the duplicate, the one with the try/catch, for the way to obtain those types. – Lasse V. Karlsen Feb 03 '20 at 10:21

0 Answers0