|
There is a lot of debate around what is the best approach to provision a Site Collection in an environment. The three techniques listed below show the pros and cons of these. Each technique gives the ability to automatically provision various elements in a Site Collection which gives:
Site Features
Site Templates
Site Definitions
Alternative to Site Definitions
An alternative to using a straight site definition is to combine the site features method with the site definitions method. This involves creating a minimal site definition and putting all the functionality that is required into features. Then tell your site definition configurations what features each should use. This way you still have the benefits around the easy provisioning of your site, but have the flexibility to turn on and off features to add/remove functionality from a site definition. Also it then becomes easy to identify sites that were based on specific definitions, allowing for an easy way to find these sepcific sites to add/remove features from them at a later date. NOTE: It is very important that you don't change the list or order of the features listed in the custom site definition. If you do, you will break all the sites that depend on that definition. As an alternative, you can use a "feature queuer". This is simply a feature that uses a feature receiver to activate other features. As far the site definition is concerned, you have not modified the list of features and thus will not break your existing sites. But you can modify the list of activations in the "feature queuer" for any new sites that would be created from that site definition. It's kind of a workaround changing the provisioning behavior of the original site definition. You can read more about it here Extending Site Definitions with Web Features An example of how this method could be used is with a customised publishing portal. It has a site definition that contains 4 configurations (1 for the root site, and 3 different sub site models that could represent the different areas of a business and their specific requirements for example) and each use a combination of features to build thier functionality up what goes in to each site. Some of the features that each site uses can be shared (for example, a customised document library might be required in all 3 sub sites, but this is still done with a single feature) while there might be some features that are used in only a specific sub site. After the site is deployed and has been in production for a while you might find you need to upgrade the sites for one of the business areas to add or remove a feature. The site definition can be upgraded and deployed with a new WSP to ensure new sub sites meet the new design, and existing sites can be updated programatically to have the features modified. These sites can be easily identified (through the SPWeb.WebTemplate property) to ensure that only they are upgraded and the other sites are left alone. So the pros and cons of this variation of the site definitions method are:
External References
Labels |
Site Features vs Site Templates vs Site Definitions

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. Hosted generously by CustomWare









Comments (12)
Dec 17, 2008
Donovan Regel says:
Ok. So now I'm a believer in "Site Features" and solution packages. And I go to ...Ok. So now I'm a believer in "Site Features" and solution packages. And I go to Codeplex and download and try STSDEV and WSPBuilder and start attempting all manner of things via Features...
But what I need is more answers on is deploying custom ASP.Net 2.0 webparts as part of a Feature (which I will be stapling to a minimalist blank site definition - following AC's guidance
). There is stuff out there on feature stapling, but not a whole lot on deploying custom webparts as part of features. My questions on the topic include the following:
Dec 17, 2008
Donovan Regel says:
In relation to question C above, I seem to have answered this myself by doing a ...In relation to question C above, I seem to have answered this myself by doing a quick test. I made a simple change to one of the wbeparts and redeployed the solution. Both existing pages displaying the feature-inserted webparts, and new sites for which the feature is activated, display the updated version of the webpart. I'm not sure of the internal mechanics, but the changes flow through.
Dec 17, 2008
Jeremy Thake says:
a) I've elaborated a bit more on the SharePoint Web Parts page with some pros an...a) I've elaborated a bit more on the SharePoint Web Parts page with some pros and cons which I hope others will start to expand on and provide more approaches too.
b) take a look at what is building up on the Creating Features page.
c) you need to remember to remove the .webpart using Feature Receiver code as it doesn't clean up by itself if you deactivate feature deploying it using either of the two approaches. That is why I prefer doing it all in FeatureReceiver so its in same place.
e) again the SharePoint Web Parts page will start to ellaborate on how web parts integrate with its page and the pages page layout etc.
f) yes, removing web parts using FeatureReceivers is covered in my sample code in my eight part series ... I'm scheduling to migrate all that to the wiki very soon!
Great questions BTW, keep them coming!
Jun 19, 2009
Blake Blackshear says:
d) To handle the race condition, I followed the below blog post to write a...d) To handle the race condition, I followed the below blog post to write a generic provider that I can use with any site definition.
http://weblogs.asp.net/paulballard/archive/2007/04/09/creating-a-custom-sharepoint-2007-portal-site-definition-using-the-portalprovisioningprovider-class.aspx
Anyone have a better solution?
Feb 10, 2009
Anonymous says:
I'd welcome feedback on Raymond Mitchell's 'Provisioning' approach to Site Defin...I'd welcome feedback on Raymond Mitchell's 'Provisioning' approach to Site Definitions.
;
I've added my own 'Feature' preference to it and blogged on it here: http://www.sharepointblogs.com/mossms/archive/2009/02/09/template-that.aspx 
Kind regards, Mike MOSSuMS Stringfellow
Feb 13, 2009
Andrew Burns says:
I think it's worth noting that several of the 'authorities' on the subject are t...I think it's worth noting that several of the 'authorities' on the subject are tending to the 'minimal' site definition and features approach. Joel Oleson has a good summary of the discussion
Mar 09, 2009
Mike 'MOSSuMS' Stringfellow says:
I've added a couple of external links to this wiki to help the discussion. Fir...I've added a couple of external links to this wiki to help the discussion.
If you have something to add, or disagree with what you see, let us know!
May 09, 2009
Anonymous says:
An article on Sharepoint Site Templates http://dotnetdreamer.com/2009/05/09/int...An article on Sharepoint Site Templates
http://dotnetdreamer.com/2009/05/09/introduction-to-site-templates/
Jun 29, 2009
Anonymous says:
Site Template is most encompassing when using a "permissions setting" workf...Site Template is most encompassing when using a "permissions setting" workflow in that site template.
You can use the GUI and SPD and VS to get the site look and feel correct, Then simply correct the fact that the
Site Template does not apply the same permissions with a once built workflow. (you also have to manualy set the incoming email address of lists I believe on the new site.)
Sites generated from a Site templates are full fidelity snapshot clones except for permissions, that includes all content, and GAC deployed workflow automatic list associativity.
Running the permissions workflow on the newly created site and the "except for permissions" limitation is removed.
Not one bit of XML editing.
I don't understand the CON mentioned above about Content type visibility. But part of the reason for moving to sharepoint was to get away from
content "stereo" typing. So I have not yet run into any limitations yet, Content types are just a filter patch when trying to add relational structure to lists. Better to organize you information such that content types are not needed.
Jul 01, 2009
Anonymous says:
I wrote "Site Template is most encompassing when using a "permissions setting"&n...I wrote "Site Template is most encompassing when using a "permissions setting" workflow in that site template."
Should say "Site Template is most encompassing when using a "permissions setting" workflow AND a "feature activation" workflow in that site template."
Obviously they could be a single "complete the clone" workflow. I guess my point is.... it depends.
The limitations in each reuse attempt all seem like workarounds to a mature product.
Click HERE to build an exact copy of this web under a new name. Is the functionality that is needed.
Jul 03, 2009
Anonymous says:
The current version of SharePoint portal does not provide template controls that...The current version of SharePoint portal does not provide template controls that all the ASPX files refer to... but with master pages on the way through ASP.NET 2.0 hopefully that will change! Site definition file changes have to be done to every affected file in that definition.
Thanks different kinds of poker games
Jan 07, 2010
Hynek Cihlar says:
A completely new approach with no cons would be provisioning the site collection...A completely new approach with no cons would be provisioning the site collections with Mossquito, No need to code C# or XML definitions, no need to create features or WSPs. Simply build the structure in a full-featured GUI and deploy to as many environments as desired.