Folder structure for a .NET application

by Peter Ravnholt 23. February 2010 15:46

I usually stick to the same base folder structure for my .NET applications. This one works well for both my open source projects and enterprise projects at work:

 

  • Branch name (usually ‘trunk’)
  • This root folder contains the solution file.

    • Application
    All the projects of the application goes here. Each project in it’s own subfolder.

    • Build

    I keep all build related stuff here, like:

    • The signing key for the application
    • A C# project holding the main MSBuild script file and any custom MSBuild tasks

    • Common
    Usually not much here, except always a SolutionInfo.cs file.

    • Documentation
    All developer-related documents of the project are kept here. This way a developer can easily get the latest version of a document without leaving Visual Studio.
    If the project contains auto-generated documentation (for instance using Sandcastle), these generator-projects are kept here as well.

    • Installers
    All installer projects are kept here (Setup projects, WIX projects). Each project in it’s own subfolder.

    • Lib
    This folder contains all the external assemblies used by the project.
    All Visual Studio projects reference the needed dll’s directly from this folder.

    • Tests
    Contains all test projects, usually divided in unit tests, integration tests and test helpers. Each project in it’s own subfolder.

     

    Note that the above is the physical folder structure. I always make sure that the version control has the excact same folder structure. Never try to build this folder structure from within Visual Studio. Instead build it by hand and add it to source control by hand.

     

    In the main Visual Studio solution file however, I alter the structure slightly by putting the contents of the Application folder directly in the solution root, and mimic the rest of the folders using solution folders:

    • Solution root
      • All projects of the Application folder
      • Build
      • Common
      • Documentation
      • Installers
      • Lib
      • Tests

     

    Now, with everything being nicely structured, it’s time to do some coding.

    Tags: , ,

    .NET development

    Comments

    Add comment




      Country flag

    biuquote
    • Comment
    • Preview
    Loading



    Powered by BlogEngine.NET 1.6.1.0

    About the author

    Peter Ravnholt

    My Delicious bookmarks

    Email

    Peter Ravnholt is working as a .NET software architect and lead developer.

    Widget Twitter not found.

    Root element is missing.X

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

     


    © Copyright 2009, Peter Ravnholt


    Creative Commons License

    Peter's .NET Ramblings
    is licensed under a Creative Commons Navngivelse 3.0 Unported License.
    Permissions beyond the scope of this license may be available at the contact page.