Juri Strumpflohner
Juri Strumpflohner Juri is a full stack developer and tech lead with a special passion for the web and frontend development. He creates online videos for Egghead.io, writes articles on his blog and for tech magazines, speaks at conferences and holds training workshops.

HowTo: Detect Assembly dependencies at runtime

1 min read

I'm currently developing a small project for myself, where I'm trying to build a small plugin framework (for experimenting purposes). In that environment I just came across the problem of detecting an assemblies dependencies at runtime. And actually to my surprise it is easier as I expected.
  1. Retrieve an instance of the current assembly. Either you have it already or it can be retrieved with

    Assembly currentAssembly = Assembly.GetExecutingAssembly();
  2. Then get all of it's referenced assemblies

    AssemblyName[] referencedAssemblies = currentAssembly.GetReferencedAssemblies();
This will give you a list of referenced assemblies which can then be instantiated in the way it is needed.
Questions? Thoughts? Hit me up on Twitter
comments powered by Disqus