Share via


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 0.0.0.0. To update the feature set it to 1.0.0.0

https://lh3.googleusercontent.com/UMRFeHC-D-67FSxcxO1Yas5LeB1Hs4550AlNfhAhCBFCBz8kJirhnP3RRqgKLGOWVRNEBBbJ3rMhNqMCsmTe3Pur3mkI3zo14fsZRxyLvPstcFSgjftKdDUj2x5476YvdhZB1i8

  1. Open the feature manifest and add the Upgrade Actions

https://lh4.googleusercontent.com/jyJpHUnHW-EBjjxvRXrwmoV32kt2SDyKUO3qIVpoAYAb8FoBwKf_n1ao-Spi1wiqFKNU9dNi8EBdM_F1oo4yKLTSS07OZDOJw1YHzlIZb5NV7C5SY0TcWaYH7vDUtlOsMu_HIVA

In the UpgradeActions place a VersionRange to tell the versions you are upgrading from and to. Give it the properties BeginVersion=”1.0.0.0″ and EndVersion=”2.0.0.0″. 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

Update-SPSolution -Identity FeatureVersioning.wsp -LiteralPath C:\devprojects\bin\Debug\FeatureVersioning.wsp –GACDeployment
  1. 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