Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a web template with 2 features, one is scoped site (to create web template) and the other is scoped web (this is for creating a list instance)

Every time i deploy the solution and create a subsite from this web template the list instance does not appear.

What i have to do is go into the subsite settings and activate the feature manually. Can this not be done automatically once a subsite is created?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Your web-scoped feature needs to be explicitly added to the <WebFeatures> section of your web template, see below:

<Project Title="Custom Site" ListDir="$Resources:core,lists_Folder;" UIVersion="4" xmlns:ows="Microsoft SharePoint">
    <NavBars>
    </NavBars>
    <Configurations>
        <Configuration ID="0" Name="CustomSite" MasterUrl="_catalogs/masterpage/v4.master">
            <Lists>
            </Lists>
            <SiteFeatures>
                <!-- "Custom Site" Web Template Feature -->
                <Feature ID="00000000-0000-0000-0000-000000000000" />
            </SiteFeatures>
            <WebFeatures>
                <!-- Custom List Instance Feature -->
                <Feature ID="00000000-0000-0000-0000-000000000000" />
            </WebFeatures>
        </Configuration>
    </Configurations>
</Project>

If you have done this, however your feature is still not being activated, do the following:

  • Check the SharePoint log files to see if it has attempted to activate your web-scoped feature. Your feature may be throwing an exception and not completing the activation phase as expected.
  • Using either SharePoint Designer or PowerShell, check that your custom web template has in fact been used to create to your new subsite.
share|improve this answer

You can associate a feature with a specific site template, but if you put "GLOBAL" instead of the template name, your feature will be activated for all websites created.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <FeatureSiteTemplateAssociation Id="29D85C25-170C-4df9-A641-12DB0B9D4130"  TemplateName="GLOBAL" />
</Elements>
share|improve this answer
    
Feature Stapling doesn't work with WebTemplates –  Per Jakobsen Nov 5 '12 at 19:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.