Wednesday, April 6, 2011

How to deploy saved site template in different SharePoint 2010 farm

As you know we could utilize the web template created by saving the site as template on SharePoint 2010. The use case listed here is that use created a site on their non-production SharePoint 2010 farm and saved as template. Use requested IT to help so other users could create site collections based on this template in production farm.

The way how to deploy this saved template for reuse is described before. The major issue left is site creation will fail if the features are not exactly same on the destination farm with template farm the template created from. There is a chance the non-production development SharePoint 2010 environment may have different features than production. When developers are testing this on their development box, they may not have all features developed to production either. How we could package the solution described in previous blog so it can be deployed and used successfully in the targeted SharePoint farm?

In SharePoint 2007, there is a tool STPInspector we could use to identify the mismatching features and repackage the stp file before the deployment. However, this tool no longer working against SharePoint 2010 wsp template. Someone will definite develop this tool shortly. At meantime, here are the way you could do to package the solution described in previous blog to a potable solution to avoid mismatching features.


  • Create a site collection on destination SharePoint farm such as production environment using the same template such as “Team Site” user using to create the previous site.
  • Save this template as template wsp file.
  • Import this first wsp file from destination SharePoint farm into your visual studio  as described in previous blog.
  • Open the ONet.xml file and find the site and web features from the <Configurations> tag.
  • Import user wsp file from source SharePoint farm into your visual studio  as described in previous blog.
  • Compare and replace the site and web features from the <Configurations> tag.
  • Repackage the solution and change the scope as described in previous blog.
  • You could deploy this to destination farm and create site collections based on this template without missing features error.
 Here is the partial of the ONet.xml for your reference.

    <Configurations>
        <Configuration ID="0" Name="Default" MasterUrl="_catalogs/masterpage/QualcommMasterElements/Qualcomm.master" ThemedCssFolderUrl="">
            <SiteFeatures>
                <!--DocumentRoutingResources Feature-->
                <Feature ID="{0c8a9a47-22a9-4798-82f1-00e62a96006e}" Name="FeatureDefinition/0c8a9a47-22a9-4798-82f1-00e62a96006e" SourceVersion="14.0.0.0" />
                <!--EnhancedTheming Feature-->
                <Feature ID="{068bc832-4951-11dc-8314-0800200c9a66}" Name="FeatureDefinition/068bc832-4951-11dc-8314-0800200c9a66" SourceVersion="14.0.0.0" />
                <!--Ratings Feature-->
                <Feature ID="{915c240e-a6cc-49b8-8b2c-0bff8b553ed3}" Name="FeatureDefinition/915c240e-a6cc-49b8-8b2c-0bff8b553ed3" SourceVersion="14.0.1.0" />
                <!--WebPartAdderGroups Feature-->
                <Feature ID="{2ed1c45e-a73b-4779-ae81-1524e4de467a}" Name="FeatureDefinition/2ed1c45e-a73b-4779-ae81-1524e4de467a" SourceVersion="14.0.0.0" />
                <!--Other Feature -->               
            </SiteFeatures>
            <WebFeatures>
                <!--WikiPageHomePage Feature-->
                <Feature ID="{00bfea71-d8fe-4fec-8dad-01c19a6e4053}" Name="FeatureDefinition/00bfea71-d8fe-4fec-8dad-01c19a6e4053" SourceVersion="1.0.0.0">
                    <Properties>
                        <Property Key="OldWelcomePage" Value="" />
                    </Properties>
                </Feature>               
                <!--WebPageLibrary Feature-->
                <Feature ID="{00bfea71-c796-4402-9f2f-0eb9a6e71b18}" Name="FeatureDefinition/00bfea71-c796-4402-9f2f-0eb9a6e71b18" SourceVersion="1.0.0.0" />
                <!—Other features-->
            </WebFeatures>
        </Configuration>
    </Configurations>



If you want to list the features on Farm, Site Collection and Site before you repackage the wsp file, you could use the powershell the discrepancy of the feature on different farms.

To see all features for a Site Collection:
  • Get-SPFeature -Site http://sitecollection
To see all features for a Site:
  • Get-SPFeature -Web http://siteurl

You could check features on farm and webapp using commands posted.

Now, you got the idea how to repackage the saved template so it can be deployed and used on different SharePoint farm.

There one issue on the sites created from such site template - the sites could NOT be backed up using Site Recycle Bin tool (Previous Site Deletion Capture) on SharePoint 2010 just discovered. I have described in the another blog http://sharepointconnoisseur.blogspot.com/2011/04/tips-and-tricks-for-site-recycle-bin.html.

3 comments:


  1. Great tutorial! Deploying saved site templates in different SharePoint 2010 farms made easy. Love the "Flowgiri webflow templates" integration! Kudos!

    flowgiri

    ReplyDelete
  2. Your tutorial is a lifesaver! Streamlining the deployment of saved site templates across various SharePoint 2010 farms is no small feat, but your guide makes it look easy. The nod to 'Flowgiri webflow templates' integration adds an extra layer of brilliance to an already stellar process. Kudos for simplifying the complex and enhancing the SharePoint experience with seamless design integration!

    ReplyDelete