Shared Assembly best practices?

Discussion in 'ASP .Net' started by CK, Jun 20, 2006.

  1. CK

    CK Guest

    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
     
    CK, Jun 20, 2006
    #1
    1. Advertising

  2. 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.

    "CK" <> wrote in message
    news:YpXlg.101203$...
    > 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
    >
     
    Marina Levit [MVP], Jun 20, 2006
    #2
    1. Advertising

  3. Hi,

    CK wrote:
    > 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
    --
    Laurent Bugnion, GalaSoft
    Software engineering: http://www.galasoft-LB.ch
    Private/Malaysia: http://mypage.bluewin.ch/lbugnion
    Support children in Calcutta: http://www.calcutta-espoir.ch
     
    Laurent Bugnion, Jun 21, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. karim
    Replies:
    0
    Views:
    467
    karim
    Jul 13, 2003
  2. bruce barker

    Re: Best way to Reference Shared Assembly?

    bruce barker, Jul 14, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    804
    bruce barker
    Jul 14, 2004
  3. =?Utf-8?B?am9qb2Jhcg==?=

    asp.net assembly best practices question...

    =?Utf-8?B?am9qb2Jhcg==?=, Oct 26, 2005, in forum: ASP .Net
    Replies:
    10
    Views:
    838
    Steven Cheng[MSFT]
    Oct 28, 2005
  4. John Dalberg
    Replies:
    3
    Views:
    575
    samuelhon
    Nov 16, 2006
  5. Chicken McNuggets

    Best book on C gotchas and best practices?

    Chicken McNuggets, Jul 31, 2013, in forum: C Programming
    Replies:
    9
    Views:
    270
    Fred J. Tydeman
    Aug 5, 2013
Loading...

Share This Page