Isaac Bolinger
Isaac Bolinger

Reputation: 7388

How can I get a list of all assemblies that have been called by the current program?

I have:

Assembly A, B, C, D

Assembly A knows about B, C, and D

Assembly B knows about C and D

Assembly C knows about assembly D

Assembly A is the entry assembly.

Within no time, code from each of these assemblies will be executed. What I want to do is spot somehow from Assembly D (A library class) that a specific (I will hard code the name of it) Assembly B (different solutions of mine use different assemblies of type 'B')has at some point been used in the program stack. That way i can get a class from assembly B instantiated in assembly D without D 'officially' knowing about B. Shouldn't there be someplace that is recording which assemblies were loaded?

Assembly A is the entry assembly, Assembly C will be the calling assembly, and assembly D is the executing assembly. How would I find B, then?

Upvotes: 0

Views: 204

Answers (1)

Isaac Bolinger
Isaac Bolinger

Reputation: 7388

I called:

AppDomain.CurrentDomain.GetAssemblies()

then I looped through them.

Upvotes: 1

Related Questions