473,385 Members | 1,356 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,385 software developers and data experts.

DLL versioning best practices?

Greetings!

I ran into the problem that a DLL could not be copied to the run file
because a newer version existed there. I seem to have gotten around it
temporarily, but I'd like to learn how DLL versioning should be managed. (A
coworker said that .Net replaced "DLL Hell" with "DLL Abyss".)

Here's my situation: I have been asked to take some pieces from a
decent-sized project out and make them into components so that other
projects can use them. I created six components, each one built in a
separate project. I have a solution named "Components" that contains all
six component projects. Some of those components contain references to
others of the components, but there are no circular references. All of the
references have their "Copy Local" property set to True. The main project
contains references to the DLL files located in the bin folders of the
component projects. Those references are also have Copy Local set to
"True".

After the "Dependency could not be copied" errors showed up, I removed all
of the references to the other components from all of my components and
created new ones using the Projects tab in the "Add References" dialog box.
I then deleted all of the files in all of my components' bin directories. I
then opened my main project. I was surprised to see that the DLL folders of
the components projects now had all of the files in them that I had just
deleted!

So, the bottom line is that beyond the bare concept that references are
required so programs will know about the structures of components they would
not otherwise know about, I understand nothing about them. Where can I find
a comprehensive discussion of how to manage references in the .Net world?

Some (but by no means all) specific questions:
1. What is the difference between referencing a project through the .Net
tab and the Projects tab in the "Add References" dialog box, and when would
I prefer using one over the other?
2. I understand from reading newsgroup postings that when looking for
references, C# (or .Net in general) will pull in the first correctly named
DLL it finds, even if that file is not in the folder the user told C# to
look for the DLL in. Why is that permitted?
3. How should I organize my DLLs and references in the project described
above?
4. What steps should I take when updating a component to make sure that
everything that needs to know about the updated version knows about it?

Thanks very much!

Rob Richardson


Nov 16 '05 #1
1 8407
Some (but by no means all) specific questions:
1. What is the difference between referencing a project through the .Net
tab and the Projects tab in the "Add References" dialog box, and when
would
I prefer using one over the other?
When you reference it through the 'projects' tab, it will know that it's
supposed to build that dependent one first, and then copy that version and
use it in the build of the 'client' project. (I believe that's the case,
anyway.)
2. I understand from reading newsgroup postings that when looking for
references, C# (or .Net in general) will pull in the first correctly named
DLL it finds, even if that file is not in the folder the user told C# to
look for the DLL in. Why is that permitted?
3. How should I organize my DLLs and references in the project described
above?
4. What steps should I take when updating a component to make sure that
everything that needs to know about the updated version knows about it?
Recompiling and redeploying all projects that are dependent on it is the
sure fire way to make certain that they will know about it, but there is
always the question of whether you can get away with doing it with less than
that. If you haven't changed the interfaces, and you haven't strong-signed
it, then xcopy deployment should work, as if you overwrite the copy in the
directory of the assembly that uses it with the new version, then the first
place it will look is in the same directory, and will therefore just blindly
pick up the new version without knowing about it. If you *have*
strong-signed it, then it's a whole different kettle of fish. If you signed
the post-update version with the same .snk file that you signed the original
with, *and* it has got the same version number (which it won't have if you
left it at "1.0.*" - because the star means automatically increment based on
the number of half-seconds since a certain time or something), then when the
new version is successfully installed in the GAC, it will replace the old
one. But this is if, and only if, the version number *and* key are the same.
If either or both of them isn't the same, then it'll show up as a different
version in the GAC, and the old (unrecompiled) application will use the old
version it's always used.

What I personally do is to assign each component a test project, which is a
dummy interface just to test the features of the component. This will then
be the only other project in the solution of the component (or maybe there
might be some dependent ones, but they must be closely-linked), and I test
it with that until it is correct w.r.t. its "black box" nature, and then I
do a release build of it, and any other project that wants to use it
references the binary in the release folder. This is good for 3 reasons, (1)
if you have all components in the same solution, recompiling when you have
only made changes to the top level one often causes all of them to be
recompiled, causing components that are going to be GACed to generate new
version numbers, resulting in a whole host of different versions, one new
one each time they are compiled, and a new application's installer will
install a separate copy of an assembly into the GAC where it is actually the
same as the previous one - using my approach, it doesn't get recompiled so
it replaces the existing one, saving space, (2) it actually forces them to
*have* a black box nature, and (3) it makes directory structures slightly
easier and when you want to update a component, you don't have to open up a
project that you don't really want to update.
Although I think that the GAC only really comes into its own when you use
installers properly, like msi, and for really permanent components that you
really don't plan on changing hardly ever.


Thanks very much!

Rob Richardson

Nov 16 '05 #2

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

Similar topics

1
by: Sasanka Pinidiya | last post by:
in simple words it's about versioning at record level. Example TableEmployee - EmployeeId, EmployeeName, EmployeeAddress, DepartmentId, TableDesignationMap - EmployeeId,...
2
by: byrocat | last post by:
I'm chasing after a documetn that was available on one of the Microsoft websites that was titled somethign like "MS SQL Server Best Practices" and detailed a nyumber of best practices about...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
13
by: john doe | last post by:
A quick question, about so-called 'best practices', I'm interested in which of A/B of the two examples people would choose, and why. public enum MyEnum { Option1 = 0, Option2 = 1, Option3 =...
2
by: Amelyan | last post by:
Could anyone recommend a book (or a web site) that defines best practices in ASP.NET application development? E.g. 1) Precede your control id's with type of control btnSubmit, txtName, etc. 2)...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
3
by: Modica82 | last post by:
Hi all, Does anyone have any views/information on the best way to version web services. I am writing a proposal on how the company should handle versioning of its web services and would like...
3
by: John Dalberg | last post by:
I am looking for an ASP.NET application on CodePlex which exemplifies best practices for the following: - Use of interfaces - Seperation of the UI, business and data tiers - Data Tier that uses...
1
by: Phil Jollans | last post by:
Hi, I have a DataSet defined in Visual Studio 2008 with an XSD file. The contents are saved to an XML file using DataTable.WriteXml() and read back using DataTable.ReadXml(). Now I am going...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.