The feature with Id 'XXX' is not installed in this farm

Problem

While working with FeatureDefinition, the following exception may pop up "the feature with Id 'XXX' is not installed in this farm".

Explanation

We could not reproduce that issue, seems to be farm, service pack or CU-related. Using FeatureDefinition.ForceActivate = true helped.

Solution

Use FeatureDefinition.ForceActivate = true

Links

  • https://github.com/SubPointSolutions/spmeta2-docs/issues/72
  • https://www.yammer.com/spmeta2feedback/#/Threads/show?threadId=582711563