One of the use cases where we use the SharePoint.DesignFactory.ContentFiles tooling is in building SharePoint Publishing (WCM) solutions for SharePoint 2007, SharePoint 2010 and Office365.
Publishing solutions are often solutions that have one instance, the publishing site (possibly with subsites), that in most cases need to go through DTAP.
If you dissect a publishing site, in most case you have the following findings:
- The publishing site spans a site collection
- The branding of the site is specified in the root site, because:
- Master pages live in the root site (/_catalogs/masterpage)
- Page layouts live in the root site (/_catalogs/masterpage)
- Preconfigured web parts live in the root site (/_catalogs/wp)
- The root site and subsites contains a document library called Pages (or your language-specific version of it) containing publishing pages using the page layouts and master pages
- The site collection contains content types, fields and lists
When using the SharePoint.DesignFactory.ContentFiles tooling it is very easy to create, test, package and deploy the artifacts that can be uploaded to the SharePoint content database. This can be done in a fast and simple way without the need to create and deploy WSP packages. If we look at the above list of artifacts we can use SharePoint.DesignFactory.ContentFiles for master pages, page layouts, the style library, web part configurations, and initial publishing pages (these are normally made through the SharePoint web UI).
Some artifacts like content types, fields and lists in the above list can NOT be handled by SharePoint.DesignFactory.ContentFiles, because they can’t be uploaded to the SharePoint content database. The good thing is that these artifacts are the artifacts that don’t change that much in the development of a SharePoint Publishing solution. There are however multiple ways to create these artifacts:
- Use paper script: create them manually in each of the environments based on documentation
- Automate the creation of the artifacts using (PowerShell) script
- Develop a WSP package to create these artifacts
I’m not a big fan of the third option (see my blog post Thoughts on building deployable and updatable SharePoint solutions). It is a lot of work to create content types, fields and list definitions using all kind of XML files, and it is not allowed to modify these artifacts when in use. I know… SharePoint 2010 has some content type upgrade possibilities, but I think it is just too cumbersome.
The first option has the problem that content types and fields get ID’s, and that these ID’s must be used by the metadata on for example page layouts. No problem for SharePoint.DesignFactory.ContentFiles, because it supports deploy-time resolving of these ID’s using PowerShell. For example consider the following metadata definition for the page layout contactpage-wcm.aspx.properties.ps1:
The PowerShell functions GetContentTypeID and GetAssociatedContentTypeInfo can at deploy-time resolve the required information from the server we are deploying to.
I personally prefer the second option: automate creation through PowerShell, because there are PowerShell scripts available to export content types and fields.
An example project structure for a typical SharePoint WCM site looks like:
Note that this project uses DualLayout.
So if you build Publishing sites using SharePoint, checkout out the completely free SharePoint.DesignFactory.ContentFiles tooling and start flying!