Tuesday, November 07, 2006

Well structured projects in Visual Studio 2005











This might be an obvious thing for some but i have missed its full potential for a while. And thank You Stefan for pointing it out to me.

There is a new feature in Visual Studio 2005 called Solution Folders. These are only a structure-thing and does not effect the namespace or naming of the things in it. The primary use for Solution Folders was probably to hold things common for the whole solution, like snk-files, build-scripts etc.

But another very nice feature is the ability to structure projects within the solution. Say that You have a number of projects (see top picutres to the left). Often You will only be in one project at the time and also they can be quite hard to get an overview of. So by simply introducing some solution folders i've got an ordered view of my projects, in the calling order of the architecture (see top picture to the right) And nothing has changed in the naming of my folder.
The solution folder structure is saved completly within the solution file (.sln) and don't reflect the file system.

A solution folder is created by right-clicking anywhere on the solutionfile and then choosing Add->New solution folder. The projects are added by simply dragging them to the folder.

A final note - if a folder is added within a project the folder name will be a part of the namespace of the items in the folder. This can of course also be handy - but the difference needs to be understood.

No comments: