30
Deep dive into feature versioning and upgrade support in SharePoint 2010 Jeremy Thake

Deep dive into feature versioning and upgrade support in SharePoint 2010

Embed Size (px)

Citation preview

Page 1: Deep dive into feature versioning and upgrade support in SharePoint 2010

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

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

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
Page 5: Deep dive into feature versioning and upgrade support in SharePoint 2010

<ListInstance>

<ContentType>

<WebPart>

<WorkflowInstance>

<Field>

Page 6: Deep dive into feature versioning and upgrade support in SharePoint 2010

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

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

“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

V1.0.0.0V12.0.0.0

Page 10: Deep dive into feature versioning and upgrade support in SharePoint 2010

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
Page 12: Deep dive into feature versioning and upgrade support in SharePoint 2010

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

Upgrading Features DeclarativelyDEMO

Page 14: Deep dive into feature versioning and upgrade support in SharePoint 2010

Upgrading Feature InstancesDEMO

Page 15: Deep dive into feature versioning and upgrade support in SharePoint 2010

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

Upgrading Features ImperativelyDEMO

Page 17: Deep dive into feature versioning and upgrade support in SharePoint 2010

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

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

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

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

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

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

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

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

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

Sharepoint HEROES

• Mike Morton (Microsoft)• Chris O’Brien (SharePoint MVP)• Josh Carlisle (SharePoint Brain Freeze)

Page 27: Deep dive into feature versioning and upgrade support in SharePoint 2010

UI Feature upgrade

• http://spfeatureupgrade.codeplex.com/

Page 28: Deep dive into feature versioning and upgrade support in SharePoint 2010

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

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

Q & A