LoadFrom and unresolved dependencies - 05-24-2005 , 12:54 PM
I have a simple set of assemblies:
Directory A: Assembly "A", references Assembly "Common" (strong identity,
signed, version 1.1)
Directory B: Assembly "B", references Assembly "Common" (strong identity,
signed, version 1.2)
If assembly A tries to load B using LoadFrom, then exception is raised.
However, if I remove a reference to "Common" either from A or B, then A
successfully loads B.
I could understand this behavior if Common did not have strong identity. But
it does! Versions 1.1 and 1.2 _are_ different assemblies, their name
equality should not matter. This is the whole point of having strong
The only explanation I have is that if you try to load an assembly with
CodeBase (using LoadFrom), then all its dependencies will also be loaded
using LoadFrom thus discarding strong version details. But is this logical?
This is what GotDotNet faqs say:
"Remember too that you can always keep an assemblys identity unique (and
thus avoid both this issue and the one described in the previous section) by
giving it a strong name."
I think this statement contradicts the way Framework resolves dependencies
of CodeBase'd assemblies.
Of course I can add a AssemblyResolve event handler, and it will help. But
isn't it a dirty approach?
|Thread Tools||Search this Thread|