Feature Element (Feature)
Applies to: SharePoint 2016 | SharePoint Foundation 2013 | SharePoint Online | SharePoint Server 2013
Defines a Feature to activate or deactivate at a specified scope.
<Feature ActivateOnDefault = "TRUE" | "FALSE" AlwaysForceInstall = "TRUE" | "FALSE" AutoActivateInCentralAdmin = "TRUE" | "FALSE" Creator = "Text" DefaultResourceFile = "Text" Description = "Text" Hidden = "TRUE" | "FALSE" Id = "Text" ImageUrl = "Text" ImageUrlAltText = "Text" ReceiverAssembly = "Text" ReceiverClass = "Text" RequireResources = "TRUE" | "FALSE" Scope = "Text" SolutionId = "Text" Title = "Text" UIVersion = "Text" Version = "Text" > </Feature>
Elements and attributes
The following sections describe attributes, child elements, and parent elements.
|ActivateOnDefault||Optional Boolean. TRUE if the Feature is activated by default during installation or when a Web application is created; FALSE if the Feature is not activated. This attribute equals TRUE by default. The ActivateOnDefault attribute does not apply to site collection (Site) or website (Web) scoped Features.In general, Farm-scoped Features become activated during installation, and when a new Web application is created, all installed Web application-scoped Features in it become activated.|
|AlwaysForceInstall||Optional Boolean. TRUE if the Feature is installed by force during installation even if the Feature is already installed. For example, if set to TRUE, Feature deployment event handlers will always fire anytime a user tries to install the Feature (even if it is already installed) by using either the scanforfeatures or installfeature command-line operation. This attribute equals FALSE by default. The AlwaysForceInstall attribute affects Features of all scopes.|
|AutoActivateInCentralAdmin||Optional Boolean. TRUE if the Feature is activated by default in the Administrative website, site collection, or Web application. This attribute equals FALSE by default. The AutoActivateInCentralAdmin attribute does not apply to Farm-scoped Features.|
|DefaultResourceFile||Optional Text. Indicates a common resource file for retrieving Feature XML resources. If you do not specify a resource in the file, SharePoint Foundation looks by default in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATES\FEATURES\*FeatureName*\Resources\Resources._Culture_.resx.However, if you want to provide a shared core resource file for all the Features in your application, you can specify an alternate file through which to access resources by using DefaultResourceFile. For example, if you set DefaultResourceFile="_MyFile_", SharePoint Foundation looks in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\Resources\*MyFile*._Culture_.resx to retrieve localized resources for your Feature.|
|Description||Optional String. Returns a longer representation of what the Feature does.|
|Hidden||Optional Boolean. This attribute equals FALSE by default.|
|Id||Required Text. Contains the globally unique identifier (GUID) for the Feature.|
|ImageUrl||Optional Text. Contains a URL relative to the \_layouts/IMAGES directory for an image to use to represent the Feature in the user interface (UI).|
|ImageUrlAltText||Optional Text. Contains the alternate text for the image that represents the Feature.|
|ReceiverAssembly||Optional Text. If set along with ReceiverClass, specifies the strong name of the signed assembly located in the global assembly cache from which to load a receiver to handle Feature events.|
|ReceiverClass||Optional Text. If set along with ReceiverAssembly, specifies the class that implements the Feature event processor.|
|RequireResources||Optional Boolean. TRUE to specify that SharePoint Foundation check whether resources exist for the Feature by verifying that the standard "sentinel" resource for the Feature is present for a particular culture.The resource file is named according to the format
|Scope||Required Text. Specifies the scope in which the Feature can be activated and contains one of the following values: Farm (farm), WebApplication (Web application), Site (site collection), Web (website). For information about scope, see Element Scope.|
|SolutionId||Optional Text. Specifies the solution to which the Feature belongs.|
|Title||Optional Text. Returns the title of the Feature. Limited to 255 characters.|
|UIVersion||Optional Text. Specifies the user interface (UI) version for this Feature. UIVersion is specified in multiple ways.*
|Version||Optional Text. Specifies a System.Version-compliant representation of the version of a Feature. This can be up to four numbers delimited by decimals that represent a version.|
SharePoint Foundation supports only low-order ASCII characters, and no spaces, for Feature folder and file names.
For an example of how this element is used, see Feature.xml Files.