Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Deep dive into feature versioning in SharePoint 2010

4,247 views

Published on

Published in: Technology
  • Dating for everyone is here: ♥♥♥ http://bit.ly/39sFWPG ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Sex in your area is here: ❶❶❶ http://bit.ly/39sFWPG ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Deep dive into feature versioning in SharePoint 2010

  1. 1. Deep dive into feature versioning and upgrade support in SharePoint 2010<br />Jeremy Thake<br />
  2. 2. Jeremy Thake <br />Enterprise Architect since April ’11 at AvePoint<br />SharePoint MVP since July ’10<br />Co-Founder of NothingButSharePoint.com<br />Speaker at MS TechEd 2009/10, SPC 11<br /> Gplus.to/jthake<br /> @jthake<br />
  3. 3.
  4. 4.
  5. 5.
  6. 6. <Field><br /><ContentType><br /><ListInstance><br /><WebPart><br /><WorkflowInstance><br />
  7. 7. Some easier than others<br />Definition vs. Instance<br />Site Column <Field><br />SPSite, SPWeb<br />Content Type <ContentType> <br />SPSite, SPWeb, SPList<br />Web Part <WebPart> <br />WP Gallery, Instances on pages<br />List Template<br />SPSite, SPWeb, Instances at SPWeb<br />
  8. 8. Some easier than others<br />Module (Page Layout, Master Page, Style sheets)<br />As long as not ‘customised’<br />Renaming files<br />
  9. 9. “OLD SKOOL”<br />Imperative in-place upgrade<br />Deactivate/Activate -> “if column missing add it”<br />Deactivate/Retract/Remove/Add/Deploy/Activate<br />Won’t work if in USE!<br />Field<br />Content Types – blocks delete<br />Web Parts out of gallery and Web Part Instances<br />List Templates – removes but breaks List instances<br />Workflow – removes assembly, breaks Workflow instances<br />New Feature - Stapling<br />PowerShell<br />
  10. 10. V1.0.0.0<br />V12.0.0.0<br />
  11. 11.
  12. 12. One farm many feature versions active<br />SITE A<br />SITE B<br />SITE C<br />SPDevWiki<br />V1.0.0.0<br />SPDevWiki<br />V3.0.0.0<br />SPDevWiki<br />V2.0.0.0<br />SPDevWiki<br />V3.0.0.0<br />SPDevWiki<br />V3.0.0.0<br />SPDevWiki<br />V1.0.0.0<br />SPDevWiki<br />V2.0.0.0<br />SPDevWiki<br />V3.0.0.0<br />
  13. 13.
  14. 14.
  15. 15. Upgrading features declaratively<br />Version attribute not just for show ;-)<br />Not set by default in XML so uses 0.0.0.0<br />ActivationDependencies can specify version<br />UpgradeActions element<br />VersionRange with Begin & End versions<br />MinimumVersion<br />ApplyElementManifest<br />AddContentTypeField<br />MapFile<br />
  16. 16. Upgrading Features Declaratively<br />DEMO<br />
  17. 17. AddContentTypeField<br />Add Columns to ContentType<br />
  18. 18. ApplyElementManifests<br />Integrated new artefacts into existing feature<br />E.g. New Fields in a Content Type<br />
  19. 19. Mapfile<br />Repoint a file to a new location on filesystem<br />E.g. renaming/relocating a deployed style sheet<br />Uncustomised files only<br />
  20. 20. DECLARATIVE FEATURE UPGRADE<br />
  21. 21. Upgrading Feature Instances<br />DEMO<br />
  22. 22. Code ran<br />update-spsolution -identity SharePointProject.wsp-literalpathbinDebugSharePointProject.wsp –GACDeployment<br />
  23. 23. Powershell<br />get-spfeature | where {$_.DefinitionId -eq '7cd284c9-b998-457b-b782-4473744b7daf' }<br />| select DisplayName, Version<br />(get-spweb http://sp2010rtm:99/).Features | where {$_.DefinitionId -eq '7cd284c9-b998-457b-b782-4473744b7daf' }<br />psconfig -cmd upgrade -inplaceb2b<br />$site = get-spsite http://siteurl<br />$enabledfeature = $site.Features | where {$_.DefinitionId -eq '7cd284c9-b998-457b-b782-4473744b7daf' }<br />if($enabledfeature)<br />{<br /> $enabledfeature.Upgrade($false)<br />}<br />
  24. 24.
  25. 25. Upgrade actions Imperative<br />Provide assembly & class in UpgradeActions<br />CustomUpgradeActionss element provides Name and Parameters<br />Fires FeatureUpgrading event receiver<br />
  26. 26. Upgrading Features Imperatively<br />DEMO<br />
  27. 27. IMPERATIVE FEATURE UPGRADE<br />
  28. 28. FEATUREUPGRADING EVENT RECEIVER<br />
  29. 29.
  30. 30. TIPS<br />Don’t forget to change definition as well do upgrade<br />ALWAYS quit PowerShell when rebuilding WSP<br />Or use different names for WSP<br />If CustomUpgradeAction fails, doesn’t upgrade feature<br />Will leave things “half baked” – defensive coding<br />Adjust ULS logs to see messages<br />‘Feature Infrastructure’, ‘Fields’, ‘General’<br />
  31. 31. What to watch - Definitions<br />Copy definition, create new one, hide old version<br />List Templates<br />Workflow<br />Site Definitions<br />or Feature stapling<br />
  32. 32. What to watch - instances<br />Web Parts<br />Imperatively modify properties<br />Assembly upgrade<br />List Instances<br />Incrementally upgrade<br />Workflows<br />Assembly upgrade on existing activities<br />Changing what activities exist on current instances<br />“You’re on your own soldier”<br />
  33. 33. SANDBOXED SOLUTIONS<br />Slightly different!<br />Upgrade button for Sandboxed Solutions<br />On upgrading a Solution<br />All Features are upgraded automatically!<br />
  34. 34. Solution version<br />Defined by having new wsp name <br />e.g. SPDevWiki_v1.0.0.0.wsp and SPDevWiki_v2.0.0.0.wsp<br />Sandboxed Solutions<br />Deploying different versions to different Site Collections in Farm<br />Supported in Farm Solutions<br />Easy way to identify what version in different Farms <br />no other way of identifying solutions<br />only keeps most recent<br />
  35. 35. Assembly versions<br />New Assembly Version<br />Workflow instances + Web Part instances<br />Will remove old version from GAC breaking old Web Parts<br />Use Binding Redirect if not worried about old assembly version – if so why do it in the first place?<br />Assembly Versioning broken in Sandboxed Solutions<br />
  36. 36. Feature upgrade object model<br />QueryFeatures method (4 overloads)<br />GuidfeatureId<br />GuidfeatureId, boolneedsUpgrade<br />GuidfeatureId, Version featureVersion<br />SPFeatureScope scope, boolneedsUpgrade<br />Available from SPWebService(Farm), SPWebApplication, SPContentDatabase & SPSite<br />
  37. 37. Versioning strategies<br />Main Goal<br />Identify which versions are across farm<br />Assembly version and Feature versions will diverge<br />Release notes needed!<br />Stick with one approach<br />Major.Minor.Build.Revision<br />Change severity (breaking/major/minor)<br />Shipping/non-shipping (product orientated)<br />Incorporate sprint/iteration<br />Incorporate changeset number<br />Other crazy approaches!<br />
  38. 38. How can I prepare 2007 code?<br />Start versioning your features – default 0.0.0.0<br /><SharePoint:UIVersionedContentUIVersion=“4”><br />Deprecated API’s<br />Binding redirects<br />VSeWSS -> VS2010 supported<br />WSPBuilder/STSDev/STSADM/custom -> manual<br />
  39. 39.
  40. 40. Sharepoint HEROES<br /><ul><li>Mike Morton (Microsoft)
  41. 41. Chris O’Brien (SharePoint MVP)
  42. 42. Josh Carlisle (SharePoint Brain Freeze)</li></li></ul><li>UI Feature upgrade<br />http://spfeatureupgrade.codeplex.com/<br />
  43. 43. Visual Studio 2010 add-in <br />TechNet walkthrough for building VSIX add-in<br />http://msdn.microsoft.com/en-us/library/ee256698.aspx<br />Tommy Segoro (WA, AUS)<br />Completed code sample<br />http://vs2010spupgrade.codeplex.com/<br />
  44. 44. REFERENCES<br />Recorded webinar and scripts from session<br />wss.made4the.net<br />My Delicious Links<br /><ul><li>SharePoint.Microsoft.com
  45. 45. SharePoint 2010 Developer Resources
  46. 46. Upgrading Custom Solutions</li></ul>SharePoint Patterns & Practices Group (SPG)<br /><ul><li>SharePointDevWiki.com
  47. 47. Getting Started in SharePoint 2010 development
  48. 48. Building a SharePoint 2010 Dev Machine</li></ul>SPDevWiki Web Cast<br /><ul><li>Running SharePoint 2010 DevEnv</li></li></ul><li>Q & A<br />

×