Quantcast
Channel: SharePoint 2010 - Setup, Upgrade, Administration and Operations forum
Viewing all articles
Browse latest Browse all 13778

sharepoint 2010 - 'save site as template' and feature stapling does not work

$
0
0

Hi,

Environment Setup:
I have a feature/stapling which upon creation of a new site changes the master page and web UI-version of this newly created web.  Following is the structure of my project:

  • Feature.xml: contains the feature guid, scope (web), and receiver assembly.
  • Stapling feature.xml: contains the normal feature info guid, scope (web application) and reference to element.xml.  This 'element.xml' contains information about association of my feature with the site templates like:

<FeatureSiteTemplateAssociation Id="guid-goes-here" TemplateName="STS#0" />

Now, I created a new site and the feature gets activated just fine and the master page is changed.

Business Need:  Save an existing site as template (with/without content), create new sites using this template, and have custom master page apply to these newly created sites.

Problem:  Feature stapling does not work when i create sites using the saved site template.  Basically, the site gets created without any errors but it applies OOB V4.master page.  When i look in the manage site features list then i can see my custom feature 'activated'.  Now, from here i can manually 'deactivate' and 'activate' the feature and it works as expected.

My Research Results:  Upon researching, it looks like that feature stapling is not supported for 'site templates' (results of save site as template).  So I downloaded the saved WSP, opened it up, and explored the ONET.xml.  It does have a reference to the feature that needs to be activated (feature receiver that would change the master page).  I came across another blog and in there the person said that if you convert following line in ONET.xml as shown then it work.  I imported the WSP in VS, changed it, packaged it, re uploaded it to SharePoint solution gallery.  Created a new site using this template and IT DOES WORK. 

From:
<!--CustomMaster Feature-->
<Feature ID="{7cc51c27-6ba1-453e-ba74-8bf1c87a72e4}" Name="FeatureDefinition/7cc51c27-6ba1-453e-ba74-8bf1c87a72e4" SourceVersion="1.0.0.0" />

To:
<!--CustomMaster Feature-->
<Feature ID="{7cc51c27-6ba1-453e-ba74-8bf1c87a72e4}" />

BUT, this is not a feasible solution. 

Anyhow, I have seen other having similar issue but NO SOLUTION; thus this post.

If you have any recommendation please do share.

Thanks for your help and time!





Viewing all articles
Browse latest Browse all 13778

Trending Articles