Monday, July 6, 2015

SharePoint 2013: Feature Versioning

Feature Versioning Overview 
Feature versioning allows Features and their associated instances to be easily tracked. Features has a version number that can be specified in the respective feature.xml file. When a Feature is activated, a Feature instance is created and associated with that version of the Feature. When a new version of a feature is deployed, the associated Feature instance also needs an upgrade as the instance version number is lower than the new version number specified in the current feature.xml file.

Update a new column/Modify an existing column
1. Update the Feature version, if a Feature does not have a Version attribute, the version is To update the feature set it to

 Feature Versioning SharePoint 2013

2. Open the feature manifest and add the Upgrade Actions

 Feature Versioning Upgrade Actions

In the UpgradeActions place a VersionRange to tell the versions you are upgrading from and to. Give it the properties BeginVersion=”″ and EndVersion=”″. Between the VersionRange you can specify what will happen when we are upgrading from version 1 to 2.
3. Upgrade the solution in the farm

-Identity FeatureVersioning.wsp
-LiteralPath C:\devprojects\ bin\Debug\ FeatureVersioning.wsp

4. After solution update, you need to call a feature.Upgrade(false) method to upgrade the  feature. 
The above method will update all the sites with feature version 1 to 2. That means you can have multiple version of the same feature installed, and selectively upgrade only the features you want. Multiple versions can live side-by-side. 
  • Microsoft SharePoint Foundation provides new members that make it possible for you to upgrade custom Features through versioning and declarative upgrade actions. As a result, you can perform the following kinds of modular upgrades to Features in SharePoint Foundation:
    • Define upgrade definitions for new Feature versions.
    • Provision a list instance as part of a Feature upgrade.
    • Create separate upgrade action sets, based on the Feature version, that remove different sets of files.
    • Apply settings to site collections where a particular Feature is activated.
  • See Also 

No comments:

Post a Comment