In this article we will be seeing about feature versioning and upgrading in SharePoint 2010. Feature Versioning and upgrading is a new feature in SharePoint 2010. Whenever a feature is activated at a specified scope in SharePoint, a feature instance is created that is associated with the current version of that feature. If a new and higher version of the feature is deployed, SharePoint 2010 detects that the associated feature instance needs an upgrade. We can make use of Version attribute on the Feature element in SharePoint 2010.
FeatureVersioningandUpgrade_0_0_0_0.wsp (Feature Version 0.0.0.0):
FeatureVersioningandUpgrade_0_0_0_0.wsp is a sandbox solution which will be deployed to the solution gallery in the SharePoint site. This has a feature, which will add a custom column (CustomField_0_0_0_0 to the site columns) on activation.
FeatureVersioningandUpgrade_1_0_0_0.wsp (Feature Version 188.8.131.52):
This will contain upgraded feature which will add CustomField_0_0_0_0 and CustomField_1_0_0_0.
Open Visual Studio 2010.
Go to File => New => Project.
Select "Empty SharePoint Project" from the installed templates.
Enter the Name as "FeatureVersioningandUpgrade" and click on Ok.
Right click on the solution and click on "Add new item".
Select the "Empty Element" template from the installed templates and enter the name.
Click on Add.
Double click on Elements.xml.
Create a custom field of type text as shown in the following.
Rename the Feature and my entire solution looks like the following.
Double click on the feature and in the properties window, set the version as 0.0.0.0.
The items in the feature
Build the solution.Right click on the solution, click on "Package".