This document discusses managing the lifecycle of SharePoint applications beyond the initial version. It covers using Feature XML and code to upgrade SharePoint applications in a standardized way. The initial build can involve provisioning with XML or code. Feature versioning and the new upgrade framework allow specifying upgrade actions using XML or code. Part 2 will discuss upgrading different artifacts like Features and Assemblies.
Managing the SharePoint Application Lifecycle – beyond version 1.0.0.0PART 1
1. Managing the SharePoint Application Lifecycle – beyond version 1.0.0.0PART 1 DEV103 Chris O’Brien - MVP
2. Chris O’Brien, MVP, MCSD.Net, MCTS www.sharepointnutsandbolts.com Twitter: @ChrisO_Brien Hands-on developer Author of ALM chapter in MVP book Creator of Content Deployment Wizard tool Regular speaker at UK user group
3. What is ALM? Definition: Considering all aspects of app through lifetime Key aspect: managing upgrades and change SharePoint presents unique challenges – complex platform!
11. Considerations in initial build Decision: provisioning with XML or code? Drivers to use code approach: Ability to debug provisioning! More control over sequencing Upgrading artifacts requires code anyway BUT, some XML always required: Site definitions, list templates, delegate controls, custom actions
12. Developing Feature XML By hand Some ‘startup’ support with VS item templates Copy/paste from last project NEW – reverse-engineer with tools Step 1: Save site as template (WSP) Step 2: Import WSP in VS2010
20. WSP import gotchas OOTB site def artifacts included NOT full fidelity: Can’t do BCS entities, code WFs, list/site defs and more.. NOT supported to import 2007 WSP! Round-trip/customized files issue Web part properties – serialized as binary
21. WSP import recommendations Do not use generated VS project itself Selectively move artifacts into ‘created’ VS project(s)
23. Approaches for upgrading Create new feature Staple to existing site def for new sites Script activation on existing sites Upgrade existing feature Old way: reactivate feature ISSUE: Some artifacts get duplicated ISSUE: May be undesirable for activation code to run multiple times New way: upgrade feature
24. Versioning/upgrading Features Version attribute now has a purpose! Define what should occur in 1.0.0.0-2.0.0.0 UpgradeActions element XML – some new XML for common scenarios Code – specify method/parameters in CustomUpgradeActions element New FeatureUpgrading method – add logic here
25. Feature upgrade XML ApplyElementManifests Integrate new artifacts into existing Feature Sometimes all you need! AddContentTypeField Add columns to content type MapFile Repoint a file to new location on filesystem (uncustomized files only)
26. Feature dependencies Can now depend on specific version of Feature (MinimumVersion) Depended-on Features auto-upgraded where possible Plus same dependency rules as 2007: Cannot depend on lower scope Hidden features cannot have dependencies
28. Triggering upgrade NOT automatic on deployment/ reactivation! Run [Foo].QueryFeatures() to find Features requiring upgrade Run SPFeature.Upgrade() on all/selected No UI, PS cmdlet, STSADM cmd to do this
29. Upgrade tool on Codeplex http://spfeatureupgrade.codeplex.com(soon!):
30. Feature upgrade gotchas Messages not logged by default – change ULS settings for : “Feature Infrastructure”, “Fields”, “General” BeginVersion inclusive but EndVersion not Newly-activated Feature instances out of sync = Feature design issue Ensure obey ‘elements by scope’ rules!
31. Summary WSP import useful in initial build Now have standardized framework for upgrading applications New XML e.g. AddFieldToContentType Implement code in FeatureUpgrading event