Site Provisioning Order
If you ever have gotten stumbled over your features not activating as expected or dependencies not working, that might have to do with site provisioning order.
SharePoint provisions in the following order:
- global onet.xml
- SPSite scoped features defined in onet.xml, in the order they are defined in the file.
- SPSite scoped stapled features, in quasi random order
- SPWeb scoped features defined in onet.xml, in the order they are defined in the file.
- SPWeb scoped stapled features, in quasi random order
- List instances defined in onet.xml
- Modules defined in onet.xml
- SPSite features should never depend on anything provisoned by an SPWeb feature. Since generally spweb scoped features are always provisioned after SPSite scoped features, the SPSite scoped feature can't rely on a resource that gets provisioned in an SPWeb scoped feature.
- Features can't depend on lists or files provisioned in onet.xml. Features are provisioned before the actual lists and files which are contained in onet.xml. However, list instances and files defined in onet.xml can take dependencies on list definitions or list instances defined in features.
- List instances and modules defined in onet.xml or within web scoped features listed in the <WebFeatures> tag of onet.xml should never take any dependencies on features that are "stapled". Stapled features are transient and may not be stapled if the admin adjusts their configuration.