Search code examples
c#.netvisual-studio-2010visual-studioprojects-and-solutions

Is it better to add all of the projects I have their code to the solution? or add only dll references?


I need evidences and resources please, I have many projects, related to each other, I have permeation to get their code, I am working only on a small subset of them, and I have the latest version of all the binaries of the other projects, is it better to add only the projects those I work with and add the references as dll references, or add the other projects even if I don't need to change them or look at them.

Is it a personal preference? and why? what is the best practice?

Note: project count is increasing, they are now: 25 projects, and counting!

Please provide references and links, not a general answer.

Note: all of the projects are developed by our team, not an external open-source projects


Solution

  • It's NOT a personal preference.

    Whenever possible you should reference the projects themselves rather than the DLLs they produce. Here's why:

    • building Debug and Release will produce consistent output
    • there won't be stale references
    • VS knows what to build when something changes, especially important when you have chained references A->B->C, changing A's dll won't cause C to be rebuilt if using DLLs

    The only possible concern to have would be how many projects you're using. If too many then break up the solution in parts where each part is itself consistent and references all projects involved, so SolutionA has Project1, Project2, Project3 and SolutionB has Project3,Project4 and Project5 but building either will still produce a consistent build. Sill keep a solution around that has all the projects for release builds.

    25 projects is still manageable. You can also have one solution with projects grouped under different solution folders so it's not one big list of 25 in VS's solution explorer but they still build at the same time.