Visit our SharePoint Forum

SharePoint developer? Submit Yourself as Freelancer

Sunday, April 27, 2008

UnderStanding Features and Solutions

Features allow reusable pieces of functionality to be created and deployed to other sites,without modifying site templates.It is always better to deploy a feature in new site instead of directly embedding mountains of complex XML.Using Features, you can do everything from adding a link to the Site Settings page to creating a complete, fully functioning Project Management suite that can be added to any SharePoint site.

Features are organized in folders under the Features directory located under 12 hives; Where SharePoint Server 2007 puts all of its system files, at the following path: %SystemDrive%\Program Files\Common Files\Microsoft Shared\web server extensions\12.

The two files that are used to define a feature are the feature.xml and Elements.xml .

The feature XML file defines the actual feature and will make SharePoint aware of the installed feature. It usually identifies the Feature itself and its element manifest file and sets the Feature scope to Web site.

Elements.xml file identifies the assembly, class, and method to implement in feature.

Add a Feature in Sharepoint:

You can use a direct deploy of a feature in sharepoint site with stsadm.exe with
stsadm -o installfeature -filename XYZEventHandler\Feature.xml
stsadm -o activatefeature -filename XYZEventHandler\Feature.xml -url


To Deploy it as solution package follow the Steps below:

*Create Manifest.XML file as part of the same project, which contains information Solution and path of feature files as part of the overall solution.
*Create a DDF file, which contains information to compress files into a CAB file.
*In the windows command prompt, run MakeCab.Exe on the DDF file to generate the WSP file. Note: MakeCab.Exe file can be downloaded from the Microsoft Site and should be copied into the same directory containing the Visual Studio Project Files.

*Add solution to Sharepoint with stsadm.exe addsolution command.


Solutions allow you to package Features in a cabinet (.cab) file and define important metadata about those Features. After a Solution is installed on a server in the farm, you can then use SharePoint’s Solution management features to automate the deployment of that Solution to other sites within the farm.

The solution manifest (always called manifest.xml) is stored at the root of a solution file.
This file defines the list of features, site definitions, resource files, Web Part files, and assemblies to process. It does not define the file structure—if files are included in a solution but not listed in the manifest XML file, they are not processed in any way.

Because the solution file is essentially a .cab file, use the makecab.exe tool to create the solution package. The makecab.exe tool takes a pointer to a .ddf file, which describes the structure of the .cab file. The format of a .ddf file is, declare a standard header and then enumerate, one file per line, the set of files by where they live on disk, separated by where they should live in the .cab file.

Features & Solutions:
The Feature Framework has been extended to allow developers to create custom Features. Features can be deployed by using SharePoint Portal Server 2007 new form of deployment, namely Solution Deployment.

Solutions are custom packages (e.g. WSP file) or redistributable CAB files, created by developers and deployed by SharePoint Administrators. Administrator can deploy Features to the individual site or to all Web front End Servers. Features are a method for developers to package customisations and deploy them to the SharePoint portal. They can then be activated and deactivated at the Site Collection level. Solutions are a way to bundle features together for deployment.


Anonymous said...

Hi...i have something to ask you.
One of my customer requested me new fields in a list.I modified the schema.xml with the required fields.
It works fine on my machine but when i make the deploy on the development the changes doesn't appear anymore...i see only the old fields.
What should I do?
Thank you in advance,

Sreenivas Gudipati said...

Hi Isha,
I have a question for you, i have created a List using custom list definition. and i have created a custom workflow aswell, and now the question is, how can i attach the workflow to that custom list, using feature not manually. ?

Sreenivas Gudipati said...

Hi Bogdan,
Did you Uninstall and Re Install on that machine.. ?

SharePoint Programming