dimanche 24 novembre 2019

C# Using reflection to get all types from all libraries

I'm trying to build a dependency management tool. So I need to get all the classes from all the libraries.

There are three projects written in C#, .NET Core 3.0.

  • ProjectA
  • ProjectB
  • ProjectC

And ProjectA reference ProjectB. ProjectB reference ProjectC.

ProjectA -> ProjectB -> ProjectC

For code in ProjectC:

// In ProjectC
Assembly.GetExecutingAssembly().GetTypes()
// That can list all classes in ProjectC.

And for code in ProjectC:

// In ProjectC
Assembly.GetEntryAssembly().GetTypes()
// That can list all classes in ProjectA.

But how can I list all classes in ProjectB?





Aucun commentaire:

Enregistrer un commentaire