References to Projects versus dlls

J

johnjohners

Which method of setting references is considered more stable? Setting a
refference to a project or its dll.

Is it a best practice to always reference a project instead of a dll
when the actual project source code is available?

Currently various projects in my solution have a mix of project and dll
references. Of course 3rd party dlls are always referenced directly.

Can referencing dlls instead of the project cause odd errors?
 
X

xhead

Which method of setting references is considered more stable? Setting a
refference to a project or its dll.

Is it a best practice to always reference a project instead of a dll
when the actual project source code is available?

Currently various projects in my solution have a mix of project and dll
references. Of course 3rd party dlls are always referenced directly.

Can referencing dlls instead of the project cause odd errors?

The rule I use is that if the reference is to a project that is in the
current solution, it should be a project reference, so that the build
of the solution will automatically manage the binaries produced.

If the assembly reference is to the DLL, which is compiled from code
that I own (and is not in the current solution), then the DLL should be
in a folder that isn't automatically updated, such as the "owner"
projects \Bin\Debug folder.

Solution1
Project1a
Project1b
references Project1a
Project1c
references Project1a
references Solution2\_Assemblies\Project2b.DLL (copy local=true)
(will copy Project2a.DLL as well)

Solution2
Project2a
Project2b
references Project2a
_Assemblies\Project2a.DLL, Project2b.DLL

When I work on Solution2 and do a compile, the binaries get put in the
normal place (project\bin\debug) and then when I have completed my
work, I will manually copy the assemblies to the _Assemblies folder.

That way, Team A can work on Solution1, and Team B can work on
Solution2, and Team B can release in a controlled fashion their updates
that Team A depends on.

This works nicely in source control too - the _Assemblies folder is
part of the source code tree (but it is the binary assemblies which are
stored in source control).

Mike
 
C

Chris Tacke [MVP]

Both have their uses. The question is why do you ask? Are you seeing some
problem?

-Chris
 
D

Daniel Moth

Which method of setting references is considered more stable? Setting a
They are equally "stable".
Is it a best practice to always reference a project instead of a dll
when the actual project source code is available?
No.
If you have no need to debug the class library then you might as well
reference the assembly rather than the project. But since switching between
the two is tedious, make sure you do that only when you are positive that
you won't need to debug the class library at the same time _or_ when you
have a separate test harness for the class library in a separate solution.
Can referencing dlls instead of the project cause odd errors?
No.

Cheers
Daniel
 

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

Top