How to scan a directory for assemblies and load them?
-
12-09-2019 - |
Question
I would like to scan a directory for any assemblies that are not already referenced in the project then load all instances of a class that implements IMyInterface.
I know that the Assembly.LoadFile method can help me out here but how do I determine if the assembly that I am loading was already referenced statically? I do not want to load any assemblies twice.
Solution
You can use AppDomain.GetAssemblies
to see which are already loaded.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow