Search code examples
visual-studioprojects-and-solutionssolution

How to organize a large project with solutions/projects/folders?


We are working on a very large VS project.

We want the project structure to "hint" developers on the logical components and design.

For this purpose, which is best:

  1. One project with many subfolders and namespaces
  2. Split to multiple projects based on logical grouping of classes. Have all projects in the same solution with solution folders.
  3. Same as #2 but have multiple solutions instead of a single with subfolders.

Solution

  • My projects are huge.

    We separate each "module" in different assemblies, creating Class Libraries. Something like this:

    Client.ProjectName (Solution)
        Client (Class Library)
            - SectionHandler...
            - ComponentModels...
            - Utilities...
    
        Client.Web (Class Library)
            - Handelrs
            - Extenders
    
        Client.Net (Class Library)
            - MailQueue
    
        Client.Blog.WebControls.UI (Class Library)
            - TopContent.ascx
            - PostsList.ascx
    
        Client.News.WebControls.UI (Class Library)
            - TopContent.ascx
            - PostsList.ascx
    
        Client.Website
    

    Each Class Library is a project under the solution Client.ProjectName or under some other shared solution.

    The file system looks like this:

    Client
    |- Framework
       |- Client
          |- files...
       |- Client.Web
          |- files...
       |- Client.Net
          |- files...
    |- SolutionName
       |- Client.Blog.WebControls.UI
       |- Client.News.WebControls.UI
       |- Website
    

    Shared client libs goes immediately under the Client\Framework folder, it is meant to be used on all projects for this client. Specific projects goes under the solution. We also have a folder called Company where we keep projects that can be used in any other project for any client, it is like the company framework.

    The solutions we use:

    • One for the company framework
    • One for a client framework
    • One for each client solution

    The same project can be referenced in multiple solutions, so you don't necessarily need to create all those solutions.

    With this format we could use a lot of things on other projects simply referencing a DLL. Without this structure some projects wouldn't be possible in the given time.