You are designing a SharePoint 2010 solution that includes a custom site definition and a custom master page.
The solution has the following three features:
A hidden site-scoped feature named X that adds the custom master page to the Master Page gallery.
.A Web-scoped feature named Y with a feature receiver that sets the master page of the Web to the master page
from feature X.
.A Web-scoped feature named Z with a feature receiver that populates the default.aspx file with sample content.
Any Web site that is created based on the solutions custom site definition must have the master page and the sample content applied to it automatically.
Your design must ensure that features X, Y, and Z can be activated in the proper order.
Which approach should you recommend?
A.
Include features X, Y, and Z in that order in the onet.xml file for the site definition.
B.
Include a user control in the custom master page to activate feature Z the first time the page is rendered, and include features X and Y in the onet.xml file for the site definition.
C.
Set feature dependencies so that feature X is dependent upon feature Y and feature Y is dependent upon feature Z, and then use feature stapling to attach feature X to the site definition.
D.
Set feature dependencies so that feature Y is dependent upon feature Z, and then use feature stapling to attach features X and Y to the site definition.
http://msdn.microsoft.com/en-us/library/office/ms432370(v=office.15).aspx
Hidden features cannot be auto-activated across scopes. So there should be visible Site scoped feature that auto-activate the dependent hidden feature.
SharePoint Foundation activates Features specified within the Onet.xml file in the order that they are listed. Consequently, you must specify Features that are depended upon before Features that depend upon them.