Managing the SharePoint 2010 Application Lifecycle - Part 1

28
Managing the SharePoint Application Lifecycle – beyond version 1.0.0.0 PART 1 DEV103 Chris O’Brien - MVP

description

The first of two presentations by Chris O'Brien at the SharePoint Evolutions Conference, aimed at SharePoint developers - covers new capabilities of SharePoint 2010 in managing changes and upgrades to exisitng apps.

Transcript of Managing the SharePoint 2010 Application Lifecycle - Part 1

Page 1: Managing the SharePoint 2010 Application Lifecycle - Part 1

Managing the SharePoint Application Lifecycle – beyond

version 1.0.0.0PART 1

DEV103

Chris O’Brien - MVP

Page 2: Managing the SharePoint 2010 Application Lifecycle - Part 1

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

Page 3: Managing the SharePoint 2010 Application Lifecycle - Part 1

What is ALM?

Definition: Considering all aspects of app through

lifetime Key aspect: managing upgrades and

change SharePoint presents unique challenges –

complex platform!

Page 4: Managing the SharePoint 2010 Application Lifecycle - Part 1

Part 1 (this session)

Upgrading a SharePoint application

• SP2010 upgradable Features• How to version a Feature• Using code/XML to upgrade

Initial build • Feature development – XML/code• Building Feature XML

Page 5: Managing the SharePoint 2010 Application Lifecycle - Part 1

Part 2 (Weds 2pm)

Upgrading a SharePoint application

• How to upgrade different artifacts

• Changes to WSP framework

• Assembly versioning in SP2010

• Versioning recommendations

Page 6: Managing the SharePoint 2010 Application Lifecycle - Part 1

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

Page 7: Managing the SharePoint 2010 Application Lifecycle - Part 1

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

Page 8: Managing the SharePoint 2010 Application Lifecycle - Part 1

Feature framework changes

Page 9: Managing the SharePoint 2010 Application Lifecycle - Part 1

ReceiversNew XML

Can now add event receiver to specific list declaratively:

Page 10: Managing the SharePoint 2010 Application Lifecycle - Part 1

PropertyBag

Used to set list item values declaratively Also entries on root web, web, list

New XML

Page 11: Managing the SharePoint 2010 Application Lifecycle - Part 1

WorkflowAssociation

Used to add workflow to list/ctype

New XML

Page 12: Managing the SharePoint 2010 Application Lifecycle - Part 1

WebTemplate

Similar to site def, for web only Also used in sandbox

New XML

Page 13: Managing the SharePoint 2010 Application Lifecycle - Part 1

CustomAction

Expanded for ribbon customization Can also add JS to page (SPSite-scoped)

New XML

Page 14: Managing the SharePoint 2010 Application Lifecycle - Part 1

Demo

WSP IMPORTStreamlining the initial site build

Page 15: Managing the SharePoint 2010 Application Lifecycle - Part 1

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

Page 16: Managing the SharePoint 2010 Application Lifecycle - Part 1

WSP import recommendations

Do not use generated VS project itself

Selectively move artifacts into ‘created’ VS project(s)

Page 17: Managing the SharePoint 2010 Application Lifecycle - Part 1

Feature versioning/upgrade

Page 18: Managing the SharePoint 2010 Application Lifecycle - Part 1

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

Page 19: Managing the SharePoint 2010 Application Lifecycle - Part 1

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

Page 20: Managing the SharePoint 2010 Application Lifecycle - Part 1

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)

Page 21: Managing the SharePoint 2010 Application Lifecycle - Part 1

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

Page 22: Managing the SharePoint 2010 Application Lifecycle - Part 1

Demo

UPGRADING A FEATUREUpdating functionality

Page 23: Managing the SharePoint 2010 Application Lifecycle - Part 1

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

Page 24: Managing the SharePoint 2010 Application Lifecycle - Part 1

Upgrade tool on Codeplex http://spfeatureupgrade.codeplex.com (soon!):

Page 25: Managing the SharePoint 2010 Application Lifecycle - Part 1

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!

Page 26: Managing the SharePoint 2010 Application Lifecycle - Part 1

Summary

WSP import useful in initial build

Now have standardized framework for upgrading applications New XML e.g. AddFieldToContentType Implement code in FeatureUpgrading event

Page 27: Managing the SharePoint 2010 Application Lifecycle - Part 1

Next time..

How to upgrade different artifacts

WSP framework changes

How to version assemblies in SP2010

Versioning recommendations • Features• Assemblies

Page 28: Managing the SharePoint 2010 Application Lifecycle - Part 1

Thank you for attending!

Part 2 – Tues 11:45am