Thursday, May 3, 2012

Visual Studio SharePoint Solution Structure

One of the key things that needs to be sorted out in the initial phase of a project is to design the solution structure. A well thought through solution structure will enable good scale-ability and flexibility to future enhancements / changes to the solution.

Visual studio by default provides a number of solution templates for SharePoint 2010. However, many a times, these do not fit in properly when there are a number of elements / features in the solution. The following is the approach that have proven to be very useful. This approach can be taken as a base approach and can be modified to suit individual needs.

The first thing that needs to be ironed out is the names schema for the folders, projects, files. For this example,
Folders:  .
Project: .Sharepoint.

Web provisioning project (XYZ.Sharepoint.Provisioning) :
This project is responsible for getting the gathering all the project deliverable in a single location and preparing for packaging of the solution. The SharePoint project consist of multiple WSPs and other artifacts. Gathering them manually from their respective folders gives a lot of room for errors (picking old files, omissions etc). This project will build the entire solution, copy all the deliverable from the respective locations and move them to a single location.


Site Structure: This project will contain all the site definitions, templates, themes, master pages etc.


Presentation, Business and Data 
The traditional 3 layer approach with separate project for Presentation, Business and data project. It is recommended to group the projects on a logical level. i.e all web parts related to a particular module should be grouped together to form a single project.

Folder Structure: The visual studio logical folder is a excellent method to organised the solution. All the similar elements should be grouped together in folders so that the solution can be easily understood by the developers. The folders are logical folders and visual studio does not create physical folder to replicate the same.

XYZ Third Party Tools: This contains the third party tools used. In case of open source tools, the code base for the same is kept here so that the source is available for enhancement in future

XYZ Tools: This folder maintains all the standalone custom tool developed for the application.

XYZ Test: This folder contains all the automated unit test projects built for the solution