Best Practices for Using Feature Versions

Applies to: SharePoint Foundation 2010

Feature versions in Microsoft SharePoint Foundation are used to trigger Feature upgrade. If you update your Feature version but do not specify any Feature upgrade logic in the Feature.xml file, when the Feature upgrade runs, it simply updates the version number of your Feature. However, if you specify Feature upgrade logic, the upgrade code is executed and the version number is automatically updated as well.

The following guidelines describe best practices for implementing Feature version numbers:

  • Increase the version number when you update a Feature and, if needed, add corresponding Feature upgrade logic. Even if you do not have to add Feature upgrade logic, you should still increase the version number so there is a way to distinguish what versions of the Feature are deployed across a server farm.

  • Keep version numbers of your Feature independent from Microsoft product versions. For example, instead of starting with 14.0.0.0 as the version number, start with 1.0.0.0 and increment subsequent versions appropriately, for example, 2.0.0.0, 2.1.0.0, and so on.

  • Increment a major version number to the current major product version the first time you create or change a Feature during a new development cycle, and reset all remaining digits to zero (for example, 2.0.0.0).

  • Increment the build version for subsequent changes during a development cycle. The build version is indicated by the 3rd digit of the build number (for example, 2.0.1.0, 2.0.2.0, and so on). When you increment the build version number (3rd digit) rather than the minor version number (2nd digit) you gain maximum versioning flexibility.

  • For an initial service pack change, increment the minor version, which is indicated by the 2nd digit, to match the service pack number, and then reset the digits that follow to zero (for example, 2.1.0.0 for the first service pack, 2.2.0.0 for the second service pack, and so on). For incremental changes to a service pack, increment the build version, which is the 3rd digit (for example, 2.1.0.0, 2.1.1.0, 2.1.2.0, and so on).