DLL Hell

B

BeerBoy

Consider this :

I have 4 projects :

Project 'Level2' is a simple class library and dependent on nothing else

Project 'Level1A' and 'Level1B' are both dependent on 'Level2'

Project 'App' is dependent on 'Level1A' and 'Level1B' but doesn't use Level2
directly

Now all worked well. Then I found a bug in 'Level2' which I fixed and
recompiled.After I recompiled 'App' everything worked fine again.

Later on I discovered a bug in 'Level1A' which I fixed and recompiled.
On recompiling 'App' I get a compilation error saying it cannot write Level2
to the 'run' folder because of a versioning problem i.e. Level1A and Level1B
have different versions in their bin.

Why is this a problem ? I know on disk I have 3 copies of Level2.dll (one in
Level2 bin and 1 in each bin of Level1A and Level1B) but the Major and Minor
numbers are the same so it shouldn't matter. Infact, in the 'App' if I set
the 'local copy' to false in the references of 'Level1A' and 'Level1B' and
then manually copy 'Level1A.dll', 'Leve1B.dll' and 'Level2.dll' (latest
verion) into the bin then it all works fine ???

I guess I could use the GAC but this is a development server so build
numbers as changing all the time and I don't really want to put every build
into the GAC.

Nor do I want to reference a load of other projects just to get the
references to work correctly !

How does everyone else handle this ?

Thanks in advance

Jim
 
H

Hans Kesting

BeerBoy said:
Consider this :

I have 4 projects :

Project 'Level2' is a simple class library and dependent on nothing else

Project 'Level1A' and 'Level1B' are both dependent on 'Level2'

Project 'App' is dependent on 'Level1A' and 'Level1B' but doesn't use Level2
directly

Now all worked well. Then I found a bug in 'Level2' which I fixed and
recompiled.After I recompiled 'App' everything worked fine again.

Later on I discovered a bug in 'Level1A' which I fixed and recompiled.
On recompiling 'App' I get a compilation error saying it cannot write Level2
to the 'run' folder because of a versioning problem i.e. Level1A and Level1B
have different versions in their bin.

Why is this a problem ? I know on disk I have 3 copies of Level2.dll (one in
Level2 bin and 1 in each bin of Level1A and Level1B) but the Major and Minor
numbers are the same so it shouldn't matter. Infact, in the 'App' if I set
the 'local copy' to false in the references of 'Level1A' and 'Level1B' and
then manually copy 'Level1A.dll', 'Leve1B.dll' and 'Level2.dll' (latest
verion) into the bin then it all works fine ???

I guess I could use the GAC but this is a development server so build
numbers as changing all the time and I don't really want to put every build
into the GAC.

Nor do I want to reference a load of other projects just to get the
references to work correctly !

How does everyone else handle this ?

Thanks in advance

Jim

Jim,

There is a fourth copy under App.
Are these projects within a single solution, or did you use multiple
solutions?
If you use 3 solutions (Level2, Level1, App), then if you change Level2 you
need
to recompile Level1 also, before recompiling App.

But : we use different solutions (each having multiple projects) and
sometimes
we encounter problems (sometimes version problems like you saw, usually
problems with the xml-documentation files) that go away when you:
- close (all) VS
- empty all bin-directories
- start VS
- open each solution and rebuild

Hans Kesting
 
B

BeerBoy

There is a fourth copy under App.
Are these projects within a single solution, or did you use multiple
solutions?
If you use 3 solutions (Level2, Level1, App), then if you change Level2 you
need
to recompile Level1 also, before recompiling App.

But : we use different solutions (each having multiple projects) and
sometimes
we encounter problems (sometimes version problems like you saw, usually
problems with the xml-documentation files) that go away when you:
- close (all) VS
- empty all bin-directories
- start VS
- open each solution and rebuild

Yes, the 4th copy is meant to be copied there by the IDE but that's my
problem, it refuses to do it.

Funnily enough, I've found that if I change Level2 I don't need to recompile
Level1, I just need to recompile the App. If however I then recompile one of
the Level1 components I need to recompile them all !?!?

I thought .Net was ment to fix all these problems...why am I having 'Deja
vu' of COM and MTS ? Versioning problems, shutting stuff down, restarting
other stuff, manually deleting stuff then putting it back in aaarrrrggghhh !
Why not simply have a Classpath ?
 
K

Kevin Spencer

Assuming that these are all projects on your machine, your references should
point to the Projects, NOT the DLLs. When you reference a Project, VS.Net
recognizes the dependencies and manages them.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
H

Hans Kesting

Kevin Spencer said:
Assuming that these are all projects on your machine, your references should
point to the Projects, NOT the DLLs. When you reference a Project, VS.Net
recognizes the dependencies and manages them.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Where should the reference point if the dll is in another solution?
(say a reusable framework in one, and the specific application in another)
As the framework is work-in-progress, I can't (won't) put that in the GAC.

Hans Kesting
 
B

BeerBoy

Where should the reference point if the dll is in another solution?
(say a reusable framework in one, and the specific application in another)
As the framework is work-in-progress, I can't (won't) put that in the GAC.

Hans Kesting

Yes ! That's exactly the problem I have !

What I've done up until now is set the 'copy local' option to false for my
references and copy the dlls manually into the bin (then reference them in
the bin). I can see no other way to do it. One problem is however that if
the dlls you reference themselves reference other dlls then you will need to
copy these into the bin too

Jim
 
K

Kevin Spencer

Hi Hans,

I think you're getting Projects and Solutions mixed up. A Solution can
contain multiple Projects. You can add the same Project to as many Solutions
as you like. If you add a Project to the Solution, you can then add a
Reference to the Project, not the DLL it creates. When the compiler runs, it
will compile the Projects, and they will be coordinated.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
B

BeerBoy

Hi Kevin,

I don't think Hans is mixing up projects and solutions. I think he doesn't
want to have lots of projects in one solution. This is understandable if a)
your project references alot of other projects / dlls e.g 10 or 15 or b)
the class libraries you refernece are also referenced by other people in
other parts of the company working on completely different applications -
you wouldn't want everyone to reference the shared projects would you ?

Jim
 
K

Kevin Spencer

you wouldn't want everyone to reference the shared projects would you ?

Sure would. And do. That's how Visual Studio.Net was designed, and that is
what Visual SourceSafe is for. And we use both.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top