Shared Assembly best practices?

C

CK

Good Morning All,
What the best way to use references? Reference a project in another project
or reference a DLL. We are developing C# Sharp Web Apps in VS 2003.
We are getting warnings like the following.
Warning: The dependency 'TTT.Library, Version=1.0.0.1, Culture=neutral' in
project 'Dmt' cannot be copied to the run directory because it would
overwrite the reference 'TTT.Library, Version=1.0.0.3, Culture=neutral'.
When I search for the file on my local box, I am getting several different
versions found in different projects. We were sort of taught, when building
a solution, the solution would contain several projects, we add the projects
to the solution as needed, then do project references inside each project
that may need that library. Is this a bad idea? Should we have just one
project in a solution and use GACUTIL.exe so it is available to all
projects? Does anyone have any good links deiscussing these topics? We had
thought if you make changes to a project that is referenced in other
projects, they would all keep the same versions. It doesn't seem to work
quite this way. Any feedback is always appreciated.
TIA,
~CK
 
M

Marina Levit [MVP]

The reason you are getting this is because you do not have a fixed assembly
version. And different DLLs are compiled with different version of this DLL

You have 3 options:

1. Ignore this error. Your assembly should be getting built anyway
2. Set the version number for the referenced DLL
3. Set CopyLocal to False in the dll reference properties

If you use the GAC, you will need to fix the assembly version, or else every
time this DLL gets recompiled, you will need to recompile everything that
references it.

I personally like to keep 1 project for every solution. This avoids any
messes or confusion.
 
L

Laurent Bugnion

Hi,
Good Morning All,
What the best way to use references? Reference a project in another project
or reference a DLL. We are developing C# Sharp Web Apps in VS 2003.
We are getting warnings like the following.
Warning: The dependency 'TTT.Library, Version=1.0.0.1, Culture=neutral' in
project 'Dmt' cannot be copied to the run directory because it would
overwrite the reference 'TTT.Library, Version=1.0.0.3, Culture=neutral'.
When I search for the file on my local box, I am getting several different
versions found in different projects. We were sort of taught, when building
a solution, the solution would contain several projects, we add the projects
to the solution as needed, then do project references inside each project
that may need that library. Is this a bad idea? Should we have just one
project in a solution and use GACUTIL.exe so it is available to all
projects? Does anyone have any good links deiscussing these topics? We had
thought if you make changes to a project that is referenced in other
projects, they would all keep the same versions. It doesn't seem to work
quite this way. Any feedback is always appreciated.
TIA,
~CK

Tastes and best practices differ... Marina told you that she prefers
having one project per solution. Me I prefer referencing projects,
except if it's a foreign assembly, the version of which is unlikely to
change.

The last project I did was ASP.NET 1.1, and we had inputs from about 15
developers, the version conflicts would have been a nightmare if we
didn't work with referenced projects. We couldn't set a fixed version
because we were using automated builds, and also for clarity.

YMMV, but for me, it's clearly better to reference projects.

HTH,
Laurent
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top