How to: Customize a SharePoint Feature
You can create and customize SharePoint features by using the Feature Designer in Visual Studio. For example, you can set the Feature scope and add other Features as dependencies. By default, the Feature Designer is opened when you add a new Feature in Solution Explorer or the SharePoint Package Explorer.
You can use the Feature Designer to modify and generate the packaged manifest file for the Feature (feature.xml). Then, you can view the XML code for this file in Visual Studio.
To view the packaged manifest file
Open the Feature Designer.
Click Manifest.
To view the packaged manifest file by using Solution Explorer
In Solution Explorer, click Show All Files.
Expand Features.
Expand FeatureName.
Expand FeatureName.feature.
Open the FeatureName.Template.xml file.
NoteWhen you open the Feature template manifest XML file, the files are automatically validated and the warnings that appear in the Error List window can be ignored.
You can change the XML code for the Feature manifest file in the Visual Studio XML Editor or the Manifest Template pane. Any changes to the XML code is merged into the packaged manifest file for the Feature. For example, you may want to change the manifest template to customize a Feature property.
To change the manifest template by using the XML Editor
Open the Feature Designer.
Click Manifest.
Expand the Edit Options node.
Click Open in XML Editor.
Changes to the XML are merged into the packaged manifest file.
To change the manifest template by using the Manifest Template pane
Open the Feature Designer.
Click Manifest.
Expand the Edit Options node.
Change the XML that appears in the Manifest Template pane.
Changes to the XML appear in the Preview of Packaged Manifest pane.
You can disable the Feature Designer and create the feature.xml file manually. The first time that you perform this procedure, the current settings in the Feature Designer are saved to the Feature template XML file. Then, you can modify or overwrite the XML code.
Note |
|---|
If you add or remove SharePoint project items in the XML file while the Feature Designer is disabled, these project items are not packaged. |
To overwrite packaged manifest file by disabling the designer
Open the Feature Designer.
Click Manifest.
Expand the Edit Options node.
Click Overwrite generated XML and edit manifest in the XML editor.
Click Yes.
The template is updated with the current packaged manifest file.