Download presentation
Presentation is loading. Please wait.
Published byDraven Shuker Modified over 10 years ago
2
SharePoint Feature and Solution upgrading Bram de Jager | Lead SharePoint Developer | Macaw
3
About Bram Lead SharePoint developer / architect for Information Worker Solutions center of Macaw Started with SharePoint 2003 Worked on projects for Shell, Hogeschool INHolland, Library of Rotterdam and Univé. Contact –http://bramdejager.wordpress.comhttp://bramdejager.wordpress.com –@bramdejager@bramdejager –bram.de.jager@macaw.nlbram.de.jager@macaw.nl
4
Agenda Basics Solution Upgrade Feature Upgrade Summary
5
Why? Creating / updating a content type in 1 site collection is easy But having 20 site collections and 10 content types changes the game
6
When to use a feature? Isolated/ autonomous piece of functionality Distributed deployment Scoping where XML or custom code runs
7
Initial build (trade-off) Custom code vs. XML Code: –Ability to DEBUG –More control –Upgrade artifact requires code XML: –Site definitions, list template, delegate controls, custom actions…
8
How was it done in 2007? Solution deployment: deploy and retract –Upgrade was supported but did not install new features Feature events: (un)install and (de)activate –No upgrade support, you would deactivate and active the feature to trigger any logic
9
Solution package Single file with extention.wsp Contains: –Assemblies (+CAS policies) –Application Pages –User Controls –Features –… Site template is a WSP, no more STP
10
Deployment life-cycle Add Solution Solution added to Solution Store Deploy Solution Files deployed to File System on all servers Feature install event fires Activate Feature(s) Element files are executed Feature active event fires
11
DEMO Create solution with choice field, deploy via PowerShell
12
SOLUTION UPGRADE SharePoint Feature and Solution Upgrading
13
Farm vs. User solutions Farm solutions supports granular upgrade User solutions will automatically upgrade all features to the latest version
14
Farm solution upgrade Update-SPSolution –Identity DevDays.wsp – LiteralPath C:\DevDays.wsp –GACDeployment Farm wide –psconfig -cmd upgrade -inplace b2b Granular –QueryFeatures() & Feature.Upgrade()
15
Granular upgrade QueryFeatures() –Guid featureId –Guid featureId, bool needsUpgrade –Guid featureId, Version featureVersion –SPFeatureScope scope, bool needsUpgrade Available for SPWebService (farm), SPWebApplication, SPContentDatabase, SPSite Feature.Upgrade()
16
Upgrade life-cycle Upgrade Solution Files updated on File System on all servers Upgrade Feature(s) Upgrade actions executed for specified version Feature upgrading event fires
17
Replacement or Update Retract & Deploy –Only on initial deployment! –Replaces all feature instances with definition Does not trigger upgrade actions No feature upgrade possible! Update –On new version of the solution –Deploys to file system Doesnt trigger install for new feature :-S
18
User solution upgrade Upload new solution package in Solution Gallery Press Upgrade button Solution and features are upgraded Its all or nothing
19
FEATURE UPGRADE SharePoint Feature and Solution Upgrading
20
Versioning Version attribute On activation a feature instance is created Deploy new version, feature definition gets updated Easy tracking of feature definition and associated feature instances
21
Feature Upgrade Upgrade according to upgrade actions Based on VersionRange with Begin & End versions –Actions for 0.0.0.0 – 0.9.9.9 –Other actions for 1.0.0.0 – 1.9.9.9
22
Multiple versions scenario v1.0.0.0 –Create Contacts list instance v2.0.0.0 –Add creation Events list instance v3.0.0.0 –Add creation Issues list instance
23
DevDays.wsp Feature DevDays v1.0.0.0 Feature DevDays v1.0.0.0 DevDays.wsp Feature DevDays v2.0.0.0 DevDays.wsp Feature DevDays v3.0.0.0 Site ASite BSite C Feature DevDays v2.0.0.0 Feature DevDays v3.0.0.0 Feature DevDays v3.0.0.0 Feature DevDays v3.0.0.0
24
Dependencies Child-child element of feature.xml element –New MinimumVersion attribute
25
UIVersion attribute New UIVersion attribute of feature.xml Specifies UI version for this feature with operators (=,, =, ;) Based on SPWeb.UIVersion (3 or 4) Example: Ribbon custom actions
26
Declarative upgrade actions New child element in feature.xml element –
27
DEMO Versioning scenario
28
CustomUpgradeAction Child element of – New feature receiver FeatureUpgrading() Support for parameters
29
DEMO Adding field to content type, copy contents, hide old field
30
SUMMARY SharePoint Feature and Solution Upgrading
31
Upgrade approach Solution update instead of retract/deploy New feature –Staple to existing site definition for new sites –Script activation on existing sites Upgrade existing feature –Farm wide or granular upgrade
32
Gotchas BeginVersion inclusive but EndVersion not Solution upgrade does not trigger (un)install event feature –When adding new feature after initial deployment, no (un)install event. Manual Install-SPFeature. Quit PowerShell when building (out of sync) Enable ULS logging, change setting to Verbose –Feature Infrastructure, Fields, General
33
Q&A SharePoint Feature and Solution Upgrading
34
Resources MSDN – Packaging and DeploymentPackaging and Deployment Chris OBrien Nuts and Bolts-blogChris OBrien
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.