Resolving Common issues while Applying Site Templates (.stp) on MOSS 2007

Lately, I have been working a lot with site templates in MOSS 2007. I have seen common issues which keep occurring now and then. I am posting the resolution of those since you might also run across them frequently.


File Cannot be found

  • This one is easy. In 99% of the cases, this usually occurs due to missing master page. If the site template has been created out of a site having a custom master page and if that master page is not present in the target machine, be ready to face this error. It can be simply resolved by uploading the required master page in Master page gallery of the target site collection.

  • Note that, if the site template contains custom webparts or user controls, this error would also come if the assembly for those controls is not found. Resolution would be to simply put the correct assemblies in bin directory of the target application and update the web.config with <safecontrol> entries.

  • You would also face the same error if the site template is a Publishing site and one of the pages in its Pages Library have been built out of a custom Page Layout. The reason is simple, page layouts are not packaged in the site template. There is no resolution to this error. You might get away by uploading the required page layout in the page layouts gallery of the target site collection , but I recommend against it. That’s one of the reasons, Microsoft does not officially support saving Publishing Sites as Template (The link in Site Settings disappears when you activate Publishing feature :)).


The template you have chosen is invalid or cannot be found

  • If you are trying to apply the custom site template (programmatically) and if the template is not present.


Add the new template by using stsadm –o addtemplate –filename <filename.stp> –title <title>

  • You can also get this error when applying the template through GUI. Obviously, the template is present but sharepoint is somehow finding it to be invalid. One of the reasons for this could be version mismatch. You cannot restore the template created out of SP1 to a non-SP1 installation of MOSS.

Resolution: Upgrade the source server and re-create the template.

(I am not sure if the template created from non-SP version can be applied to SP1 installation of MOSS).

  • Thirdly, this error also comes when you have feature dependency missing. Basically the site from which the template was created has one or more custom feature activated on it which are not present on the target installation.


If you know the missing feature, install the feature on the target machine.

However, even if you have made sure that you have all the required features present and are still facing this error, it can be easily debugged.

Rename the .stp file to .cab file and extract manifest.xml out of it. If we open the manifest.xml, it would contain the list of dependent feature ids in a section like this:

 <Feature ID="a392da98-270b-4e85-9769-04c0fde267aa" /> 
 <Feature ID="f6924d36-2fa8-4f0b-b16d-06b7250180fa" /> 
 <Feature ID="695b6570-a48b-4a8e-8ea5-26ea7fc1d162" /> 
 <Feature ID="89e0306d-453b-4ec5-8d68-42067cdbf98e" /> 
 <Feature ID="ca7bd552-10b1-4563-85b9-5ed1d39c962a" /> 
 <Feature ID="d3f51be2-38a8-4e44-ba84-940d35be1566" /> 
 <Feature ID="aebc918d-b20f-4a11-a1db-9ed84d79c87e" /> 
 <Feature ID="00bfea71-1c5e-4a24-b310-ba51c3eb7a57" /> 
 <Feature ID="bf120348-ef6f-4526-a9a8-d4f4b897c790" /> 
 <Feature ID="00bfea71-c796-4402-9f2f-0eb9a6e71b18" /> 
 <Feature ID="29d85c25-170c-4df9-a641-12db0b9d4130" /> 
 <Feature ID="00bfea71-5932-4f9c-ad71-1557e5751100" /> 
 <Feature ID="00bfea71-4ea5-48d4-a4ad-305cf7030140" /> 
 <Feature ID="00bfea71-f600-43f6-a895-40c0de7b0117" /> 

The feature IDs listed under SiteFeatures tag  are the site collection features on which the site  was dependent upon when the site template was saved as a template.

Similarly, As you might have guessed, features IDs listed under WebFeatures tag are Site features on which the template was dependent.

Armed with this information, you can simply do a text search on Features folder of your target installation to see which feature is missing and deploy-activate the missing feature on the target machine. Usually, I have seen custom feature are at the bottom of the list and out of the box features are at the top, but don’t take this observation to be granted in your case :).

If you know of any other resolutions, or fighting/fought with any similar issue , do leave me a comment and I’ll update my post (along with credits ofcourse).