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 curious of what you’re experiences are one the user of site definition compared to feature stapling. In a video on Channel 9 Ted Patterson explains that feature stapling is the way to go. It would be nice to know of some experiences other SharePoint experts have.

Are you all using Feature stapling or are there areas where Site Definitions is a better choice?

share|improve this question

6 Answers 6

I would say that, if your site is a custom one, go with the site definition, it is easier to set, to manage and to deploy.

If your feature needs to be attached to built-in site definitions, go with the site stapling, if your feature is not changing the base nature of that site definition.

The big problem with the feature stapling, is that it gets confusing when you have a lot of features to staple.

share|improve this answer

Depends on what you want to do. If you want to run some of your own code during the creation of a site then Feature stapling really is the way to go.

share|improve this answer

Personally, I find that feature stapling is the way to go - I use Site Definitions as a 'stub' to attach features to, and the features actually configure up the site.

Later, if you want to add extra elements to your sites you can staple additional features (for future sites) or activate the feature on existing sites. And you can test elements of the solution independently!

Sometimes, though, it is better to build things into the site def. I alway find deploying ListView web parts to a site's homepage is best achieved actually within the site def, rather than as a stapled feature.

Worth a read - http://www.andrewconnell.com/blog/archive/2008/02/15/You-dont-need-to-create-site-definitions.aspx

share|improve this answer

I wouldn't go for a site definition anymore now that there are WebTemplates in Sharepoint 2010. It's like a site definition, but you can upload it per sitecollection, add features to it, etc. So it's the good things of a site template and site definition combined together. A little introduction can be found here: http://www.sharepointchick.com/archive/2010/03/11/using-the-sharepoint-2010-webtemplate-feature-element-for-creating-site.aspx

share|improve this answer

I used to think feature stapling was the best/only way. But then i found out that features stapled can be activated in ANY order. So if you have one feature that provisions security groups, then another one that provisions lists, and the last provisions permissions. You could get situations where the permission feature is trying to provision before the lists have been created.

Now i use a combination of both site definitions and feature staplings.

share|improve this answer

Agree with Djeeg, i combine both as well. The fact features get activated in random order from stapling can be highly frustrating since you will only get COM exceptions etc. Feature Dependency goes a long way, but that has it's limitations as well.

The orer of activation is:

  1. SITE DEF -> Site scoped features (in order)
  2. SITE STAPLING -> Site scoped features (NOT in order)
  3. SITE DEF -> Web scoped features (in order)
  4. SITE STAPLING -> Web scoped features (NOT in order)
  5. Modules in the ONET.XML
share|improve this answer

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.