SharePoint 2007 allows administrators the ability to save a site as a Site Template using the Site Actions > Site Settings > Save this site as a template option. This creates an STP file that is added to the Site Templates gallery of the Site Collection. This is useful if you want to create more Sites in the Site Collection that are based on the same configuration.
Now if you look carefully at STSADM however you will notice that there is a command (addtemplate) which allows an administrator to add a Site Template to the farm template gallery. This allows you to create Site Collections based on the uploaded Site Template.
When you save a Site Template from a site that makes use of custom Features the following needs to be considered when deploying your solution:
- In order to create a Site Collection you need to make sure that your custom Features are deployed to the Web Application for Central Admininistration (typically hosted on the Application Server).
- In order to create a Sub Site you need to make sure that your custom Features are deployed to the Web Application hosting the Site Collection where you are creating your Site.
If your custom Features are not available in the environment that you are attempting to create your Site Collection or Site you will receive the following error message:
The template you have chosen is invalid or cannot be found
To troubleshoot which custom Features are causing the issue you can do the following:
- Change the extension of your Site Template file from STP to CAB.
- Open the manifest.xml file in the CAB.
- Find the SiteFeatures and WebFeatures nodes.
- Search the Features Folder* for the GUIDs listed in the above nodes.
- Any GUIDs missing from the Features Folder means that you have features which have not been deployed to the appropriate server.
* c:\program files\common files\microsoft shared\web server extensions\12\template\features
Alternatively download a copy of STP inspector to make troubleshooting much less tedious.