I have an Assembly A
, this Assembly dynamically loads Assemblies B
, C
, and E
. And it'll load more in the future.
Issue one:
B
references F
and G
, when I try to execute methods in an instance of a type declared in B
, from A
, I get an exception telling me that F
wasn't found, of course.
Questions:
- How can I reference
F
andG
when I dynamically load AssemblyB
, assumingF
andG
are in the same folder asB
? - How can I reference
F
andG
when I dynamically load AssemblyB
, assumingF
andG
are in a different folder?
Issue two:
This pretty much comes from the fact that, in trying to quickly test some functionality, I copied the referenced assemblies from B
's binaries folder to A
's, which resulted in the following exception:
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I assume this comes from the fact that I'm using a different version of log4net
than one of the dependencies of B
does.
Question:
What measure can I take to avoid this kind of versioning issues?
Will fixing issue one fix this issue? If not, why?
Should I use Autofac for this?
Will it help me? How?
Keep in mind the idea of Assembly A
is to take "plugins", and in that order, declaratively pointing at the Assemblies or their dependencies isn't an option