Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project Structure for C# Development Effort [closed]

What directory/solution/project structure do you find to be the most manageable and convenient for medium to large projects written in C#? By "medium to large" I mean projects which include a diverse set of Visual Studio C# project types in a hierarchical structure with nested namespaces.1

I'm primarily interested in those project types found in the 'Windows' section in Visual Studio 2008: Windows Forms, WPF, Custom Controls for both and Class Libraries. Additionally, I'm using MSBuild (via Visual Studio) to build my project.

I've never found the default structure automatically generated by Visual Studio to be worth using. This structure has one folder solely for containing the solution and a nested folder for each project. I'm wondering if this is because of the scale of project I've used C# for in the past (small to medium). What benefits does this structure have for larger projects? Have you found it useful?

I'm also interested in things like folder names and their relation to namespaces.

The following are my personal goals for project structure.

Goals

  • Each project should be reasonably self-contained. That is, I'd prefer to be able to check each one out individually and compile it (where permitted by dependencies).
  • Navigating the structure should be easy.
  • Directory structures should map to namespaces in a clear and straightforward way.
  • Identifying solution files should be easy.
  • Projects should build with little or no extra effort in Visual Studio (MSBuild) at most or all levels of the heirarchy

    1. Please note that my use of the word 'projects' here means 'development efforts' except where explicitly noted.
like image 490
Waylon Flinn Avatar asked Apr 25 '09 17:04

Waylon Flinn


People also ask

What is file structure C?

A FILE is a type of structure typedef as FILE. It is considered as opaque data type as its implementation is hidden. We don't know what constitutes the type, we only use pointer to the type and library knows the internal of the type and can use the data. Definition of FILE is in stdio although it is system specific.


2 Answers

You may want to check out TreeSurgeon.

like image 29
Kent Boogaart Avatar answered Oct 17 '22 15:10

Kent Boogaart


I currently use a structure where the whole system is split into logical parts, each part being a separate Visual Studio solution. Each such solution is contained in a folder structure looking like this:

[logical part name]
  |-doc
  |-lib
     |- // any non-GAC-assemblies needed by the projects in the solution
  |-src
     |-Production
     |  |-Project1
     |  |-Project2
     |-Tests
        |-UnittestProject1
        |-UnittestProject2
  |-tools
     |- // any tools needed for automated builds and such 
        // (NUnit, NCover, MSBuild tasks, ...)

This does require some moving around of files (output from one logical part that is referenced by another needs to be moved into that other part's lib folder, for instance) but this can easily be automated within an MSBuild script. We also have such an MSBuild script that calls the MSBuild scripts of each of the logical parts in order, and moves the output into the appropriate lib folders. This way I can build the logical part that I am currently working with in one step, and also make a build of the full system with one click (or, well, double click).

We have used that structure in the current project for the last year and a half or so, and it seems to work out rather well.

like image 195
Fredrik Mörk Avatar answered Oct 17 '22 15:10

Fredrik Mörk