Sunday, November 21, 2010

SharePoint 2010 / Visual Studio 2010 – Organizing Project Structures

As I have become more comfortable with the new SharePoint development framework, one thing I had trouble with was how to best organize a project within Visual Studio 2010. While there are plenty of examples on how to develop within the new framework, I haven’t been able to find any good resources or documentation that go into how to best organize your project. After consulting with some co-workers, I have come up with the following generic structure for WebPart projects and UI projects.

  • WebPart Projects – This is typically a project that requires more control over resources and how they get deployed. In this case I use SharePoint Mapped Folders to organize my solution. You can create these at any level and even create multiple levels, but I like the idea of mimicking the actual SharePoint 14 “hive” hierarchy starting with the TEMPLATES folder.
  • UI (MasterPage, Layout, and Branding) Projects -  These are types of resources that I’d like to be more easily accessible by designers and site owners. In this case, I use Module folders to organize my solution. MasterPages are mapped to the site Master Page Gallery _catalogs/masterpage. Layouts, images, and css are deployed to a document library (i.e. the “Style Library” found on Publishing Portals).

Important: Regardless of how you plan on organizing your projects, make sure that you always deploy your resources within a folder with your project name. This lessens the chance of your resources getting overwritten since they would reside in a unique location.  For example, in the WebPart project below, I have a folder under CONTROLTEMPLATES called “Acme.Intranet.WebParts”. In the case of the UI project, I use Modules, so I would need to map these using the Url property of the Module node in the Elements.xml file.


No comments:

Post a Comment