SharePoint Feature and Solution upgrading
description
Transcript of SharePoint Feature and Solution upgrading
![Page 1: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/1.jpg)
![Page 2: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/2.jpg)
SharePoint Feature and Solution upgrading
Bram de Jager | Lead SharePoint Developer | Macaw
![Page 3: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/3.jpg)
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.com– @bramdejager– [email protected]
![Page 4: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/4.jpg)
Agenda• Basics• Solution Upgrade• Feature Upgrade• Summary
![Page 5: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/5.jpg)
Why?• Creating / updating a content type in
1 site collection is easy• But having 20 site collections and 10
content types changes the game
![Page 6: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/6.jpg)
When to use a feature? • Isolated/ autonomous piece of
functionality• Distributed deployment• Scoping where XML or custom code
runs
![Page 7: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/7.jpg)
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…
![Page 8: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/8.jpg)
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
![Page 9: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/9.jpg)
Deployment life-cycleAdd
SolutionSolution 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
![Page 10: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/10.jpg)
DEMOCreate solution with choice field, deploy via PowerShell
![Page 11: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/11.jpg)
SOLUTION UPGRADESharePoint Feature and Solution Upgrading
![Page 12: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/12.jpg)
Farm vs. User solutions• Farm solutions supports granular
upgrade• User solutions will automatically
upgrade all features to the latest version
![Page 13: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/13.jpg)
Farm solution upgrade• Update-SPSolution –Identity DevDays.wsp –
LiteralPath C:\DevDays.wsp –GACDeployment
• Farm wide– psconfig -cmd upgrade -inplace b2b
• Granular– QueryFeatures() & Feature.Upgrade()
![Page 14: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/14.jpg)
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()
![Page 15: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/15.jpg)
Upgrade life-cycleUpgrade Solution
Files updated on File System on
all servers
Upgrade Feature(s)
Upgrade actions executed for
specified version
Feature upgrading event
fires
![Page 16: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/16.jpg)
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
• Doesn’t trigger install for new feature :-S
![Page 17: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/17.jpg)
User solution upgrade• Upload new solution package in
Solution Gallery• Press Upgrade button• Solution and features are upgraded• It’s all or nothing
![Page 18: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/18.jpg)
FEATURE UPGRADESharePoint Feature and Solution Upgrading
![Page 19: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/19.jpg)
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
![Page 20: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/20.jpg)
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
![Page 21: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/21.jpg)
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
![Page 22: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/22.jpg)
DevDays.wsp
Feature DevDaysv1.0.0.0
Feature DevDaysv1.0.0.0
DevDays.wsp
Feature DevDaysv2.0.0.0
DevDays.wsp
Feature DevDaysv3.0.0.0
Site A Site B Site C
Feature DevDaysv2.0.0.0
Feature DevDaysv3.0.0.0
Feature DevDaysv3.0.0.0
Feature DevDaysv3.0.0.0
![Page 23: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/23.jpg)
Dependencies• Child-child element of feature.xml• <ActivationDependency> element– New MinimumVersion attribute
![Page 24: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/24.jpg)
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
![Page 25: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/25.jpg)
Declarative upgrade actions• New child element in feature.xml• <UpgradeActions> element –<VersionRange>–<ApplyElementManifest>–<AddContentTypeField>–<MapFile>
![Page 26: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/26.jpg)
DEMOVersioning scenario
![Page 27: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/27.jpg)
CustomUpgradeAction• Child element of <UpgradeActions>–<CustomUpgradeAction>
• New feature receiver FeatureUpgrading()
• Support for parameters
![Page 28: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/28.jpg)
DEMOAdding field to content type, copy contents, hide old field
![Page 29: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/29.jpg)
SUMMARYSharePoint Feature and Solution Upgrading
![Page 30: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/30.jpg)
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
![Page 31: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/31.jpg)
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
![Page 32: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/32.jpg)
Q&ASharePoint Feature and Solution Upgrading
![Page 33: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/33.jpg)
Resources• MSDN – Packaging and Deployment• Chris O’Brien “Nuts and Bolts”-blog
![Page 34: SharePoint Feature and Solution upgrading](https://reader034.fdocuments.in/reader034/viewer/2022051002/56815d39550346895dcb3b97/html5/thumbnails/34.jpg)