473,326 Members | 2,182 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

HELP!! I'm having "DLL Hell" in .NET

Hello,

We have a small team building a project that involves some 30 or so c#
assembly dlls. It is a client server application with 1 exe as the
starting point. The dlls and exe are sharing an assemblyinfo file that
has a strong name and version assiciated with it. We are having
problems in the way we have been developing. We have made two attempts
at this.

Attempt 1) In our first attempt, we basically had 1 folder that
contained all the output assemblies. This used to be the way we did
things in COM, but this causes us to have to re-compile every
dependant project when we make changes. I thought .NET was supposed to
solve this? On top of this, every dll get's locked by Visual Studio.
This means it becomes difficult to open more than one Visual Studio
project at once (another thing we used to do frequently in COM with no
problems). We had all "copy local = false" set for all references
since they all pointed to one output directory. We even tried
variations of the copy local settings depending on whether the project
was the starting main exe or a referenced assembly. We just couldn't
get it right so we did some research on the web and switched to
Attempt 2.

Attempt 2) Now we have each assembly pointing to it's own output
directory in a hierarchy format. The exe is the root directory with
all the supporting assemblies in directories in the root. We have
been very conscious that the reference paths are all in the corect
order to make sure the correct asssemblies are being referenced. This
means that each assembly has (in it's output folder) a copy of the
assemblies it needs. This is accomplished because we set copy local =
true for each reference in these assemblies. The exception is the main
executable. In here we have all the assembly references set to copy
local = false. We found this approach on the web and it seemed that
this was the nirvana we were seeking. But the reality is that we were
still having problems. We cannot compile any core assembly without
having to re-complile every dll that references it. In COM, there was
the concept of binary compatibility which allowed us to compile core
dlls as long as it didn't break the Interface (i.e. we could do
internal changes and/or add methods and properties). I'm thinking .NET
should be at least this good if not better. On top of this, we now
have to manage our reference paths hiarchy. Since the main executable
points to each output folder, the order of the reference paths is
crucial since core dlls show up several times (from the perspective of
the main exe). We are also very consious of the project build order
settings which are set correctly.

So in short, both methods yield COM like results (if not worse). And
many times we won't find the errors until run-time which is even
worse. We'll get assembly IO errors due to assembly manifests
version's not matching. We also occasionally get dll locking issues
caused by a number of reasons such as User Controls and having
multiple Visual Studio's open.

I'm convinced that there is a correct way to do this. Is there a 3rd
way that we should be developing or is one of our first two attempts
close but not exactly right?

Any help would be greatly appreciated.

Thanks,
Dave
Nov 22 '05 #1
1 1759
Ahhhh!

Finally, we got everything working. The problem was we were trying to
get too cute. Here is a list of problems we were doing wrong which
compounded our problems, so if you're having similar problems please
advise:

1) Use the default Build Paths Microsoft provides in each of your
projects. This is extremely important and in fact, Microsoft has a
huge known bug if you don't do this (and your dlls are larger than
64kb). Check out this article for more details:
http://support.microsoft.com/?id=313512. We were getting bit by this
one big time.

2) Very related to #1, leave CopyLocal = true for all referenced
projects.

3) All references should be done by project rather than by dll (unless
of course it is a 3rd party dll). This yields several advantages and
has no down sides (that I know of). One of the biggest advantages is
that Visual Studio can determine your build order.

4) What this allows you to do is basically have every project open in
1 solution. Then, Visual Studio will figure out what needs to be
compiled and when. This is a movement away from the way I remember
teams developing in COM. In otherwords, the dlls are now arbitrary and
the heart of everything is the code.
ch********@yahoo.com (malcolm) wrote in message news:<4f**************************@posting.google. com>...
Hello,

We have a small team building a project that involves some 30 or so c#
assembly dlls. It is a client server application with 1 exe as the
starting point. The dlls and exe are sharing an assemblyinfo file that
has a strong name and version assiciated with it. We are having
problems in the way we have been developing. We have made two attempts
at this.

Attempt 1) In our first attempt, we basically had 1 folder that
contained all the output assemblies. This used to be the way we did
things in COM, but this causes us to have to re-compile every
dependant project when we make changes. I thought .NET was supposed to
solve this? On top of this, every dll get's locked by Visual Studio.
This means it becomes difficult to open more than one Visual Studio
project at once (another thing we used to do frequently in COM with no
problems). We had all "copy local = false" set for all references
since they all pointed to one output directory. We even tried
variations of the copy local settings depending on whether the project
was the starting main exe or a referenced assembly. We just couldn't
get it right so we did some research on the web and switched to
Attempt 2.

Attempt 2) Now we have each assembly pointing to it's own output
directory in a hierarchy format. The exe is the root directory with
all the supporting assemblies in directories in the root. We have
been very conscious that the reference paths are all in the corect
order to make sure the correct asssemblies are being referenced. This
means that each assembly has (in it's output folder) a copy of the
assemblies it needs. This is accomplished because we set copy local =
true for each reference in these assemblies. The exception is the main
executable. In here we have all the assembly references set to copy
local = false. We found this approach on the web and it seemed that
this was the nirvana we were seeking. But the reality is that we were
still having problems. We cannot compile any core assembly without
having to re-complile every dll that references it. In COM, there was
the concept of binary compatibility which allowed us to compile core
dlls as long as it didn't break the Interface (i.e. we could do
internal changes and/or add methods and properties). I'm thinking .NET
should be at least this good if not better. On top of this, we now
have to manage our reference paths hiarchy. Since the main executable
points to each output folder, the order of the reference paths is
crucial since core dlls show up several times (from the perspective of
the main exe). We are also very consious of the project build order
settings which are set correctly.

So in short, both methods yield COM like results (if not worse). And
many times we won't find the errors until run-time which is even
worse. We'll get assembly IO errors due to assembly manifests
version's not matching. We also occasionally get dll locking issues
caused by a number of reasons such as User Controls and having
multiple Visual Studio's open.

I'm convinced that there is a correct way to do this. Is there a 3rd
way that we should be developing or is one of our first two attempts
close but not exactly right?

Any help would be greatly appreciated.

Thanks,
Dave

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dino | last post by:
hello, every night i'm running a simple cronjob which created sql-dumps from serevral web applications using a syntax like this: mysqldump --add-drop-table -uuzzer -hmyhost -pmypw mydatabase...
1
by: malcolm | last post by:
Hello, We have a small team building a project that involves some 30 or so c# assembly dlls. It is a client server application with 1 exe as the starting point. The dlls and exe are sharing an...
2
by: n8wei | last post by:
Hi, I seem to be having a bit of a problem serializing a complex object into XML. I've done this many times with simpler objects and it's always worked just fine. The error I'm getting is...
2
by: Jozef | last post by:
Hello, I am trying to put together a module and open a workspace on a database that has a simple password (using Access XP). This is the lin that I'm having trouble with; Set wrk =...
0
by: Kent P. Iler | last post by:
Hi, I have a data repeater that is returning a list of events. One of the things I want to do is give the user a way to edit or delete an event. My plan was to use an Imagebutton that would...
15
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
8
by: Xu, Wei | last post by:
Hi, I have wrote the following sql sentence.Do you have comments to improve the performance.I have created all the indexed. But it's still very slow.Thanks The primary key is proj_ID and...
1
by: wilsonbell | last post by:
I've just written my first call out and it supposed to be simple, but I can't get it to work, and of course, I can't debug it. I'm not getting errors in the Event log, and I can't be sure what...
2
by: fuyumi87 | last post by:
Hi, I am currently making a list, where users can click the Add-button to add stuffs to the list, and click the Delete-button to delete the selected item. However, because it starts with an Empty...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.