.NET Project Layout

A standard layout for .NET projects.


A few years back, David Fowler (from the ASP.NET team) proposed a standard project layout for .NET projects. It has slowly been gathering popularity since then. I propose that the .NET community should rally around this layout and use it for all appropriate projects moving forward.

The proposed layout is as follows:

$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
  tests/
  .editorconfig
  .gitignore
  .gitattributes
  build.cmd
  build.sh
  LICENSE
  NuGet.Config
  README.md
  {solution}.sln

The directories are used for the following purposes:

  • /src - The main projects / the product code.
  • /tests - The test projects.
  • /docs - Documentation files, help files, etc.
  • /samples - Sample projects, usage examples, etc.
  • /lib - Libraries (and similar) that can't ever exist in a nuget package.
  • /artifacts - Build output. Running the build scripts should generate artifacts here.
  • /build - Build scripts, etc.

When you're next deciding how to structure your .NET projects, please strongly consider using this layout.


Posted by Matthew King on 10 March 2020
Permission is granted to use all code snippets under CC BY-SA 3.0 (just like StackOverflow), or the MIT license - your choice!