![Page 1: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/1.jpg)
Deep dive into feature versioning and upgrade support in SharePoint 2010Jeremy Thake
![Page 2: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/2.jpg)
Jeremy Thake
• Enterprise Architect since April ’11 at AvePoint
• SharePoint MVP since July ’10• Co-Founder of NothingButSharePoint.com• Speaker at MS TechEd 2009/10, SPC 11
Gplus.to/jthake@jthake
![Page 3: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/3.jpg)
AGENDA
• Introduction• Declarative• Imperative• What to watch• How to prepare 2007 Solution Packages
![Page 4: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/4.jpg)
![Page 5: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/5.jpg)
<ListInstance>
<ContentType>
<WebPart>
<WorkflowInstance>
<Field>
![Page 6: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/6.jpg)
Some easier than others
• Definition vs. Instance– Site Column <Field>
• SPSite, SPWeb– Content Type <ContentType>
• SPSite, SPWeb, SPList– Web Part <WebPart>
• WP Gallery, Instances on pages– List Template
• SPSite, SPWeb, Instances at SPWeb
![Page 7: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/7.jpg)
Some easier than others
• Module (Page Layout, Master Page, Style sheets)– As long as not ‘customised’– Renaming files
![Page 8: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/8.jpg)
“OLD SKOOL”
• Imperative in-place upgrade– Deactivate/Activate -> “if column missing add it”
• Deactivate/Retract/Remove/Add/Deploy/Activate– Won’t work if in USE!
• Field• Content Types – blocks delete• Web Parts out of gallery and Web Part Instances• List Templates – removes but breaks List instances• Workflow – removes assembly, breaks Workflow
instances
• New Feature - Stapling• PowerShell
![Page 9: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/9.jpg)
V1.0.0.0V12.0.0.0
![Page 10: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/10.jpg)
One farm many feature versions active
SPDevWikiV1.0.0.0
SPDevWikiV2.0.0.0
SPDevWikiV3.0.0.0
SPDevWikiV1.0.0.0
SPDevWikiV2.0.0.0
SPDevWikiV3.0.0.0
SITE A SITE B SITE C
SPDevWikiV3.0.0.0
SPDevWikiV3.0.0.0
![Page 11: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/11.jpg)
![Page 12: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/12.jpg)
Upgrading features declaratively
• Version attribute not just for show ;-)– Not set by default in XML so uses 0.0.0.0– ActivationDependencies can specify version
• UpgradeActions element– VersionRange with Begin & End versions– MinimumVersion– ApplyElementManifest– AddContentTypeField– MapFile
![Page 13: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/13.jpg)
Upgrading Features DeclarativelyDEMO
![Page 14: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/14.jpg)
Upgrading Feature InstancesDEMO
![Page 15: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/15.jpg)
UPGRADEactions Imperative
• Provide assembly & class in UpgradeActions• CustomUpgradeActionss element provides
Name and Parameters• Fires FeatureUpgrading event receiver
![Page 16: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/16.jpg)
Upgrading Features ImperativelyDEMO
![Page 17: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/17.jpg)
TIPS
• Don’t forget to change definition as well do upgrade
• ALWAYS quit PowerShell when rebuilding WSP– Or use different names for WSP
• If CustomUpgradeAction fails, doesn’t upgrade feature– Will leave things “half baked” – defensive
coding• Adjust ULS logs to see messages
– ‘Feature Infrastructure’, ‘Fields’, ‘General’
![Page 18: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/18.jpg)
What to watch - Definitions
Copy definition, create new one, hide old version
• List Templates• Workflow• Site Definitions
– or Feature stapling
![Page 19: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/19.jpg)
What to watch - instances
• Web Parts– Imperatively modify properties– Assembly upgrade
• List Instances– Incrementally upgrade
• Workflows– Assembly upgrade on existing activities– Changing what activities exist on current
instances• “You’re on your own soldier”
![Page 20: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/20.jpg)
SANDBOXED SOLUTIONS
• Slightly different!• Upgrade button for Sandboxed Solutions• On upgrading a Solution
– All Features are upgraded automatically!
![Page 21: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/21.jpg)
Solution version
• Defined by having new wsp name – e.g. SPDevWiki_v1.0.0.0.wsp and
SPDevWiki_v2.0.0.0.wsp• Sandboxed Solutions
– Deploying different versions to different Site Collections in Farm
• Supported in Farm Solutions– Easy way to identify what version in different
Farms • no other way of identifying solutions• only keeps most recent
![Page 22: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/22.jpg)
Assembly versions
• New Assembly Version– Workflow instances + Web Part instances– Will remove old version from GAC breaking
old Web Parts– Use Binding Redirect if not worried about old
assembly version – if so why do it in the first place?
• Assembly Versioning broken in Sandboxed Solutions
![Page 23: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/23.jpg)
Feature upgrade object model
• QueryFeatures method (4 overloads)– Guid featureId– Guid featureId, bool needsUpgrade– Guid featureId, Version featureVersion– SPFeatureScope scope, bool needsUpgrade
• Available from SPWebService(Farm), SPWebApplication, SPContentDatabase & SPSite
![Page 24: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/24.jpg)
Versioning strategies
• Main Goal– Identify which versions are across farm– Assembly version and Feature versions will diverge
• Release notes needed!
• Stick with one approach– Major.Minor.Build.Revision– Change severity (breaking/major/minor)– Shipping/non-shipping (product orientated)– Incorporate sprint/iteration– Incorporate changeset number– Other crazy approaches!
![Page 25: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/25.jpg)
How can I prepare 2007 code?
• Start versioning your features – default 0.0.0.0
• <SharePoint:UIVersionedContent UIVersion=“4”>
• Deprecated API’s• Binding redirects• VSeWSS -> VS2010 supported• WSPBuilder/STSDev/STSADM/custom ->
manual
![Page 26: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/26.jpg)
Sharepoint HEROES
• Mike Morton (Microsoft)• Chris O’Brien (SharePoint MVP)• Josh Carlisle (SharePoint Brain Freeze)
![Page 28: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/28.jpg)
Visual Studio 2010 add-in
• TechNet walkthrough for building VSIX add-in– http://
msdn.microsoft.com/en-us/library/ee256698.aspx
• Tommy Segoro (WA, AUS)– Completed code sample– http://vs2010spupgrade.codeplex.com/
![Page 29: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/29.jpg)
REFERENCES
• Recorded webinar and scripts from session• wss.made4the.net• My Delicious Links• SharePoint.Microsoft.com• SharePoint 2010 Developer Resources
• Upgrading Custom Solutions• SharePoint Patterns & Practices Group (SPG)• SharePointDevWiki.com
• Getting Started in SharePoint 2010 development• Building a SharePoint 2010 Dev Machine– SPDevWiki Web Cast• Running SharePoint 2010 Dev Env
![Page 30: Deep dive into feature versioning and upgrade support in SharePoint 2010](https://reader034.vdocuments.us/reader034/viewer/2022051616/556ac554d8b42acd348b4bca/html5/thumbnails/30.jpg)
Q & A