Frage

Specifically what are the do's and dont's for installing, activating, deactivating and uninstalling a feature. What are the problem areas of working with features and how do you handle.

War es hilfreich?

Lösung

some good practices are:

  • use feature activation dependencies to control multiple hidden features activations with single master feature
  • clean up web parts on deactivating for web parts added by feature activation

some bad practices are:

  • rely on feature activation order using dependencies
  • clean up data structures (lists/sites) on feature deactivation

some problem areas are:

  • mix features of different scope in a same solution package
  • plan for cross-scope feature dependencies

Andere Tipps

The best advice I've received on the topic was use the "Boy Scout Method" where you take out whatever you bring in. For example, when your feature is deactivated, it shouldn't leave traces of what it deployed when it was originally activated.

Depending on what you're deploying with the feature, this gets tricky. For example, if it's a content-type or list definition, you won't be able to deactivate the feature if there are any instances of it on the site. Test your feature deactivation in your development environment.

The Feature Upgrading functionality in SharePoint 2010 is useful for versioning changes to your features. Inevitably, the requirements for your feature will change and you'll need to make some changes to it. Chris O'Brien wrote this series on the topic.

Weigh the benefits of declarative / schema based feature definitions vs. using C# and Feature Event handlers. If it's a simple list instance, creating site columns and content types may not be necessary, using C# and Feature Event Handlers could save time and reduce the amount of overhead added to the site for something simple.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top