The Feature.xml follows the Collaborative Application Markup Language (CAML) convention to define a feature.
<?xml version="1.0" encoding="utf-8" ?>
<Feature
xmlns="http://schemas.microsoft.com/sharepoint/"
Id="11111111-1111-1111-1111-111111111111"
Title=""
Scope="Web"
>
<!-- Element Manifests -->
<ElementManifests>
<ElementManifest />
<ElementFile />
</ElementManifests>
<!-- Dependencies -->
<ActivationDependencies>
<ActivationDependency />
</ActivationDependencies>
<!-- Properties -->
<Properties>
<Property />
</Properties>
</Feature>
Feature attributes
You will need to create yourself a Feature.xml file using any text \ xml editor. The xml file should contain a Feature element with two required attributes, Id and Scope and a useful title attribute.
xmlns (recommended)The namespace that the feature element belongs to and should be
http://schemas.microsoft.com/sharepoint. In visual studio, this will assist with Intellisense and syntax errors.
Id (Required)The Id is a globally unique identifier (GUID) for the feature. Each feature you create should have a unique ID. To create a GUID from Visual Studio, Choose the Tools \ Create GUID menu.
Scope (Required)The scope defines where the feature can be activated and can be one of the following
Farm,
WebApplication,
Site (Site collection) and
Web (Web Site).
Title (recommended)The title is optional text (max 255 chars) that will be displayed in the list of available features. Give short names that describe your feature
Description (optional)Write a detailed description of what your feature does, this will be displayed in the UI where the feature is activated.
ImageUrl This attribute defines a relative Url to an image file that represents the feature. The feature should be placed into the sites images folder, typically it is 12\TEMPLATE\IMAGES. I would suggest creating a sub folder under images for your own images.
ImageUrlAltText (Optional)Contains alternate text for the image of the feature.
Hidden (Optional)The hidden attribute can be set to either TRUE or FALSE (default). If the attribute is set to true, the feature will not appear in the UI and can only be activated from the command line using STSADM -o activatefeature
Version (Optional)Specifies a System.Version compliment version number of the feature, i.e. Major.Minor.Revision.Build. The version number can be up to foru numbers separated by decimals. An example would be 1.0.0.0
Creator (Optional)Any text to define the author or application that created the feature.
ReceiverAssembly (Optional with ReceiverClass) This attribute is used to indicate the assembly and class to automatically execute when the feature is either installed, uninstalled, activated or deactivated. This attribute must be used with the ReceiverClass. The assembly name should be a four-part strong name for the assembly, i.e. Dll name, Version, Culture, PublicKeyToken.
ReceiverClass (Optional with ReceiverAssembly) This attribute defines the class name including the namespace of the .NET class in the ReceiverAssembly that implements the Feature events. This attribute must be set with the ReceiverAssembly. When the feature is installed, uninstalled, activated or deactivated the provisioning engine will load the ReceiverAssembly and create an instance of the ReceeiverClass. The provisioning engine will then execute the relevant overridden method,
Additional attributes also exist, including
- ActivateOnDefault
- AlwaysForceInstall
- AutoActivateInCentralAdmin
- DefaultResourceFile
- RequireResources
- SolutionId
Feature Child Elements
ActivationDependencies
The ActivationDependencies child element defines a list of other features that the current feature depends on.
ElementManifests
The ElementManifests element is used to define various feature elements and functionality.
Properties
The Properties element defines default values for any feature property.
Feature Deployment Location
Features are deployed to the [12 Hive]\TEMPLATE\FEATURES folder. In other posts there will be discussions on how to package and deploy features properly.
