473,396 Members | 1,923 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,396 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 1762
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.