0

I want the main app to be able to load plugin1.dll which has dependency on

PlugingCore.dll but when I try using Assembly.LoadFile("c:\plugin1.dll"); I get an error:

('((System.Reflection.RuntimeAssembly)a).DefinedTypes' threw an exception of type 'System.Reflection.ReflectionTypeLoadException')

Note: both PluginCore.dll and Plugin1.dll are in same directory.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
Ivandro Jao
  • 2,731
  • 5
  • 24
  • 23
  • hvae you tried with `Assembly.LoadFrom("c:\plugin1.dll")`? – Damith Nov 25 '16 at 03:43
  • see if [assembly (error: System.Reflection.ReflectionTypeLoadException)](http://stackoverflow.com/a/23717112/3796048) solves your problem – Mohit S Nov 25 '16 at 03:43
  • Copy the exception details and add them to your question. https://blogs.msdn.microsoft.com/saraford/2008/08/07/did-you-know-you-can-copy-the-exception-details-with-one-click-from-the-exception-assistant-276/ – Scott Chamberlain Nov 25 '16 at 04:21
  • I found the answer in http://stackoverflow.com/a/15093022/2766753. btw thank you @damith :) That is step 1 solve. Is there any way it can be done by using `Assembly.Load()` method instead? – Ivandro Jao Nov 25 '16 at 04:51
  • If you can modify main application please add AppDomain.AssemblyResolve event. The reason why dependency is not loaded is that it simply resides in folder other than main application. Please refer i.e. http://stackoverflow.com/a/5262129/7047935 – smartobelix Nov 25 '16 at 05:45

0 Answers0