Luke Vo
Luke Vo

Reputation: 20728

How to get the list of all loaded assemblies ordered by dependencies

I know AppDomain.GetAssemblies can be used to get all loaded assemblies of the current app but there is no guarantee of order remarked there. I need that list but also need to make sure that dependencies are listed before their host.

For example: [B, A, A.Optional, A.Optional.Data, C] (A.Optional.Data depends on A.Optional, which in turn depends on A; A, B and C are not related so it doesn't matter what order they are in).

Is it possible?

Why I need it: I have an MyAttribute used to decorate multiple classes across multiple assemblies. At the end (final project), I need to gather them and register those classes. However the order of registering is important and A.Optional classes need classes in A registered before them to work correctly.

Upvotes: 1

Views: 56

Answers (0)

Related Questions