Namespaces and folder structures in c# solutions: how should folders on disk be organised?

前端 未结 8 736
野趣味
野趣味 2021-02-04 06:26

First off, let’s agree that namespace should match folder structure and that each language artefact should be in its own file.

(see Should the folders in a solution ma

8条回答
  •  误落风尘
    2021-02-04 06:41

    If you use the nested projects you run the risk of hitting the windows MaxPath issue. This is a huge deal breaker for ever using nested structures. Just imagine meeting this little Gem half way though a dev project, having to name VS projects with 3 letter acronyms just so as not to hit MaxPath. An MS bug ending up as the inspiration for the names of your assemblies. What a joke that would be. Working with a flat structures is much better all round.

       -SouceControlFolderName
         -Project1
           -Src
             -Main
               -Company.Project1.AppName
                 *Company.Project1.AppName.sln
                 *Company.Project1.AppName.Tests.sln
                 -Company.Project1.AppName.Common
                 -Company.Project1.AppName.Common.Tests
                 -Company.Project1.AppName.Entities
                 -Company.Project1.AppName.Entities.Tests
                 -Company.Project1.AppName.Security
                 -Company.Project1.AppName.Security.Tests
                 -etc.
    

    You could create a separate directory for the test projects or as above and have them all together which is easier to manage when adding to source control i.e. Subversion (TFS is better in many ways save for the fact it needs Explorer integration not just VS integration and a proper off-line story)

提交回复
热议问题