Deep Dive building solutions on the SharePoint Framework - SPS Brussels 2016
Deep dive into feature versioning and upgrade support in SharePoint 2010
-
Upload
jeremy-thake -
Category
Technology
-
view
1.752 -
download
4
Transcript of Deep dive into feature versioning and upgrade support in SharePoint 2010
Deep dive into feature versioning and upgrade support in SharePoint 2010Jeremy Thake
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
AGENDA
• Introduction• Declarative• Imperative• What to watch• How to prepare 2007 Solution Packages
<ListInstance>
<ContentType>
<WebPart>
<WorkflowInstance>
<Field>
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
Some easier than others
• Module (Page Layout, Master Page, Style sheets)– As long as not ‘customised’– Renaming files
“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
V1.0.0.0V12.0.0.0
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
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
Upgrading Features DeclarativelyDEMO
Upgrading Feature InstancesDEMO
UPGRADEactions Imperative
• Provide assembly & class in UpgradeActions• CustomUpgradeActionss element provides
Name and Parameters• Fires FeatureUpgrading event receiver
Upgrading Features ImperativelyDEMO
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’
What to watch - Definitions
Copy definition, create new one, hide old version
• List Templates• Workflow• Site Definitions
– or Feature stapling
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”
SANDBOXED SOLUTIONS
• Slightly different!• Upgrade button for Sandboxed Solutions• On upgrading a Solution
– All Features are upgraded automatically!
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
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
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
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!
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
Sharepoint HEROES
• Mike Morton (Microsoft)• Chris O’Brien (SharePoint MVP)• Josh Carlisle (SharePoint Brain Freeze)
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/
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
Q & A