I thought Microsoft did a good job documenting sp2010. I am so frustrated that I can't find anything related to this. I have a web template project. All I want is to run bunch of code when a web is provisioned. I put the code in the featureactivated of the webtemplate and it seems the code is not kicking in (and no error is given).

  • For reference, what is the GUID it can't find? Some of us are sad enough (no names!...) to be able to identify an out of the box GUID from one generated on the fly. Does it match the GUID that's in the feature in your WebTemplate project?
    – James Love
    May 8 '11 at 20:05
  • Yes sir, I copied the featureid from it's manifest file and made sure it's in onet.xml file. May 8 '11 at 20:06
  • Cool. Now ensure that the Feature exists in the Package in your project. Also, check in the SharePoint Root / 14 Hive under TEMPLATE/Features to see if your feature folder actually exists in there, once deployed.
    – James Love
    May 8 '11 at 20:54

I'm not really a developer but I'll take a stab at this one given that our team is currently looking into replacing our custom site definitions with Web templates for SP2010. Feel free to correct me if any of this is incorrect - I'm certainly at the learning stage when it comes to Web templates.

At a basic level you will need to ensure that the feature (be it custom or out of the box) is activated. However, a more complex scenario involving sub site creation and feature dependency is described below.

One possible cause for this issue is attempting to create sub sites (Webs) using a Web template which depends on a site collection scoped feature that is not activated - i.e. you put an inactive site collection scoped feature in the "SiteFeatures" section of the ONET.xml file.

From what I understand SharePoint checks features in the SiteFeatures section of the ONET.xml file in the order specified. If a required site scoped feature is found but not active the above error is thrown. Note that this behaviour differs from that in SharePoint 2007 - back then any site scoped features were also activated for sub sites (this is a deliberate improvement in flexibility, not a bug).

To get around the situation described above, one option is to remove the site collection (Site) scoped from the "SiteFeatures" section in the ONET.xml and instead use a Web scoped feature to activate the required feature using an event receiver. If you choose this option you will need to ensure that this new feature is placed above the other Web scoped features in the "WebFeatures" section of your ONET.xml file.

Of course, the suitability of this fix depends on the scope of your Web template. If this is just a one off scenario you may wish to simply enable the required farm or site collection scoped feature manually using PowerShell.

As James has said it would be helpful to know whether the required feature is custom or out of the box in order for us to assist further.

See this post from Vesa Juvonen for more information: http://blogs.msdn.com/b/vesku/archive/2010/10/14/sharepoint-2010-and-web-templates.aspx#webtempelement


Site Collection scoped features are not automatically activated on the Site Collection when you create sub sites.

  • In a round about way I hope my post includes this point :-) May 8 '11 at 20:59
  • lol, didn't see your post until I posted mine... May 8 '11 at 21:02
  • right on the money! Both of u beat me to this one. Saw it no more than 2 hours ago where i reactivated the web template solution and got the same error due to creating a subweb and site scoped feature didnt get activated. Actually in SP2007 site scoped features were activated at web level too, but that was a bug that is now fixed in SP2010 May 8 '11 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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