GetReferencedAssemblies is used to retrieve all referenced assemblies by assembly. But sometimes
this list is not complete, and does no contain all assemblies, that are simply added to project references in Visual Studio.
Assembly.GetExecutingAssembly().GetReferencedAssemblies()
The problem is, that assembly is loaded to AppDomain “on demand” – lazy load – you must first “call/use something” from that assembly.
You need to explicitly call a static function or create some object from referenced assembly in your source assembly.
//Referenced assembly dll public class DummyInit { } //Source assembly, that is referencing above assembly using Referenced.Assembly.NameSpace; public class SomeClass { public function SomeFunc() { DummyInit di = new DummyInit(); //Assembly.GetExecutingAssembly().GetReferencedAssemblies() now should contain Referenced Assembly } }
Leave a Reply