C# Visual Studio – Directory Structure for a .NET Solution

cvisual studio

We had a contractor visit recently who questioned our methodology of structuring projects. Please note that I am specifically referring to the directory structure. He suggested using the Microsoft guidelines. I thought I would be able to Google "Microsoft guidelines .NET project directory structure" and find something helpful, however this has proven not to be the case. As it stands we do something like this:

[Company.System.Feature]
  |-doc
     |Sandcastle project
  |-lib
     |Nuget packages
  |-src
    |-Project1 e.g. web
    |-Project2 e.g. business logic
    |-UnittestProject1
    |-Specs

The doc folder contains a Sandcastle solution like what is described here: https://www.codeproject.com/Articles/15176/Sandcastle-Help-File-Builder (see: absolute and relative paths). Therefore the doc folder contains a Help folder, which contains the generated help file. The lib folder contains all Nuget packages.

Are there any Microsoft guidelines, which recommend how to structure a solution? I have looked here: https://stackoverflow.com/questions/789389/project-structure-for-c-sharp-development-effort/789554?noredirect=1#comment86756309_789554 amongst other places. Most of the articles and questions I have read seem to be created 2007-2009. I believe Nuget was introduced in 2010.
Are there any Microsoft guidelines? I read about something called Tree Surgeon, however this does not seem to exist anymore: https://archive.codeplex.com/?p=treesurgeon.

I am using TFS; Cruise Control and DDD is that makes any difference.

Best Answer

On MSDN, there are some very old official guidelines. These are out of date though. As the page says, "This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies." So I'd recommend you avoid these guidelines.

There was an attempt to define a common solution structure via Project Scaffold. This is more orientated toward F# though, rather than C#. It didn't really take off though and there's little sign of development of the ideas these days.

The most active and up to date set of guidelines is maintained by David Fowler, who is a developer at Microsoft on the ASP.NET team. These guidelines are used by many within Microsoft, including the Roslyn (the C# and VB.Net compiler) teams. You could do far worse than adopt that approach therefore.