Posts Tagged ‘SharePoint Features’

HowTo remove unused features from a site template file

November 16, 2009 Leave a comment

When you create a site template (.stp) or an export via stsadm.exe you will end up with a cabinet formatted archive with all the data and some XML files. One of these XML files, the Requirements.xml, contains references to all requirements the site template has. Unfortunately, SharePoint adds references to core features even if they’re not required. Typically, when you export a site from a SharePoint Enterprise server, all the enterprise features are included as requirements even if the feature set is turned off and not used.

To fix this you will need to modify the Requirements.xml file inside the cabinet archive. This is how I do it:

  1. Rename the export or template file to .cab
  2. Extract all content to a separate directory
  3. Modify the Requirements.xml by removing all lines referring to features which is not required (be careful!)
  4. Create a new .cab file with all the same content and the modified Requirements.xml (I use Microsoft’s cabarc.exe)
  5. Rename the new cabinet file with the proper file extension
  6. Import the file according to the SharePoint environment

Please note that any errors in the XML file or removal of actual required features may result in a corrupt cabinet file and/or a corrupted site, so BE CAREFUL!


%d bloggers like this: