Editing WSP templates

Why

When trying to deploy a SharePoint site template I run into the following error:

The site template requires that the Feature {068bc832-4951-11dc-8314-0800200c9a66} be installed in the farm or site collection

Long story short the template had dependencies on Enterprise features which prevented it from being deployed to SharePoint foundation.

Ramble Tamble

I thought it would be a matter of deploying a missing template. However this template is included in the Enterprise version of SharePoint (SharePoint 2010 Features).

The project involved javascript customizations of a SharePoint site, but we didn't have access to the production environment. We got a SharePoint template that we had to enhance. We didn't really know much about the environment so I worked on my development environment where I have SharePoint Enterprise set up.

Unfortunately when you create a site in SharePoint Enterprise several features are activated by default so you can deploy templates back to SharePoint foundation. By the time we got the error we were already done with the project, we had to deploy and the client was waiting to test. So I needed to deploy the site quickly. Redoing all the customization was out of the question. The good news is that we were not using the enterprise features so if we could remove the dependencies from the template it would still work fine under Foundation.

A while back I had to deploy a legacy 2007 list template and found a solution where the stp was edited and repackaged so that it would work in 2010: Using PowerShell to Convert SharePoint 2007 List Templates (STP) for SharePoint 2010 The solution is excellent and I thought I could apply it to a site template as well. Here is where the adventure begins...

As you probably know, wsp are cab files, so we can easily extract the contents and edit them with makecab.exe, alternatively winrar can also extract the file (however you must use makecab to recreate it). In the example I found a powershell script is used to extract, modify and repackage an stp file into a wsp file. The problem is that it was not recursive. having little experiencie with powershell I decided to recreate the process with a T4 template.

Resources

  1. SharePoint 2010 Features
  2. Creating a Solution Package in Windows SharePoint Services 3.0
  3. Using PowerShell to Convert SharePoint 2007 List Templates (STP) for SharePoint 2010

In summary, to 'downgrade' an Enterprise Site template to work in Foundation we have to:

Note: this can be applied to any wsp and might be useful in other contexts.


comments powered by Disqus

Categories

Under Construction

About Me

Martin here. I'm a developer by choice. Focused in SharePoint & JavaScript.

  • Follow me on Twitter