Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using multiple versions of an assembly at the same time

7 views
Skip to first unread message

discharge

unread,
Sep 19, 2011, 8:49:44 AM9/19/11
to
To this day, I wrote libraries and applications themselves (to help in
work and at home) and somehow I advised. But now it has so many of
these applications and libraries that there are strange situations - I
describe below.

I have library named X.DLL that uses the library Y.DLL (version 1).
After some time, the Y.DLL has been improved, changed, etc and now I
use version 2 of it.
And now I created an application A.EXE that uses the Y.DLL v2 library.
In Solution Explorer, I have a reference to Y.DLL (v2).
It need to use a library X.DLL in A.EXE.
In Solution Explorer of A, I now have a reference to X.DLL too.

Everything looks Ok. Building A does not report problems. And
application can even run.
A.EXE code invokes a Y.DLL version 2 and everything still looks Ok.

However, when A.EXE calls X.DLL (X.DLL code works), and this calls
Y.DLL v2, the application crashes with exception telling that Y
version 1 not found.

In fact, the Y.DLL v1 is indicated in the project X (as reference)
or in the \ bin \ Debug of project A I have Y v2 and subdirectory
named X containing X.DLL (to which reference is set without the 'Copy
local' option) and Y.DLL v1. If I'm well informed, an assembly first
looks for code (referenced assembly) in it's own directory, next in
dir named like assembly which it searches.
But in this situation X looks like it is seeing through the eyes of an
application A, and instead of look to \bin\Debug\X, it is looking at
the \bin\Debug.

-- References (what uses what):

A-->Yv2

X-->Yv1

A-->X


-- \bin\Debug:

A.exe

Y.dll (v2)

X (dir)
-- \bin\Debug\X:

X.dll

Y.dll (v1)


Can someone explain this effect?

0 new messages