Guidance on solution and project structure

2019-07-16 06:40发布

问题:

I now have to deal with a whole lot of very badly structured solutions and projects. My first bugbear is solution files within project folders. To me this smells very bad, as projects are subordinate to solutions, and maintaining a healthy solution folder structure should not rely only on the solution file contents, but should be implicit in the actual Windows folder structure.

I would like to propose a standard for use by me and my colleagues, and in this suggest a truly hierarchical structure with a Code folder containing a solution file, and subordinate folders for all projects, containing only .csproj files and source, no solution files! I would very much also like to include some useful background information justifying my proposal, but I don't want to ramble too much and would like sources I could maybe quote, with attribution of course. What good articles, tutorials, books, etc. could I consult for this?

回答1:

A good reference article on this topic can be found here. Note: This is a very OLD article dating back to the days of .net 1.1 but the general principles about projects / solutions still very much remain the same and still apply, IMO

Note that this article is talking about how to structure solutions and use with VSS but the general principle of how to organize the projects and solutions apply to any source control system (i will take a leap of faith and assume that you do not use VSS :-))

Folder structure, specifically, is something that different projects may even organize differently based on their logical architecture. However, this article will also give you a point of reference to make your point about solutions being at a higher level than the projects in general.

This blog is also discussing overall solution / project structure and you might want to use some of the points made here if they are relevant to your code.