How do I load a dll and its dependencies? I don't want to place each of the dependent dlls in an Assembly.Load. I'd rather just load the one dll and then the dependencies are loaded.
The above dlls aren't loaded when my application launches. They are only loaded when a user does a specific action, which then freezes the gui.
A workaround is to create an instance in my window's constructor and then set that instance to null. That definitely doesn't feel like the most elegant solution. Or is it? Thanks.
You could load your assembly, then use:
var names = myAssembly.GetReferencedAssemblies();
Assembly.GetReferencedAssemblies will give you the full list of assemblies referenced by your assembly. Just load those, as well, and you'll have loaded all of your dependencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With