Adding Features during Solution Update
-
16-10-2019 - |
Question
Is there a supported method to add features during a solution update.
We call Update-SPSolution
and then upgrade our old features using SPFeature.Upgrade
but any new features in the solution do not appear to be deployed.
We could call Install-SPFeature
for the missing features but we feel this is unsupported as Get-Help Upgrade-SPSolution
displays the following
get-help Update-SPSolution
NAME
Update-SPSolution
SYNOPSIS
Upgrades a deployed SharePoint solution.
DESCRIPTION
The Update-SPSolution cmdlet upgrades a deployed SharePoint solution in the
farm. Use this cmdlet only if a new solution contains the same set of files
and features as the deployed solution. If files and features are different,
the solution must be retracted and redeployed by using the Uninstall-SPSolution
and Install-SPSolution cmdlets, respectively.
This seems pretty clear cut and implies that solution update can only be used to deploy new versions Assemblies and existing files.
The same set of files comment does not make sense to use because of the existence of the ApplyElementManifest which only seems to be useful to apply new element manifests e.g. new webparts.
Have we misunderstood the use of ApplyElementManifest and MapFile?
What is the real world experience of adding Features during solution update?
Solution
As the documentation states, when you add new artifacts to a solution you need to reinstall it. Really nothing new here, except for support for solution dependencies (and this is really only half implemented, since you can delete solutions that other solutions depend upon without getting any warning)
Feature upgrade is an entirely different matter. No upgrades are triggered when solutions are upgraded. As you state yourself you need to trigger the upgrade either through powershell or code.
Upgrading features has really received attention in SP2010. The new ways of upgrading features both declaratively and through code gives you really good ways of keeping your existing feature instances up to par with the feature definition.
In SP2007 feature manifests would only be fired once. ApplyElementManifests gives you the possibility to add new artifacts during upgrade.
MapFile gives you the possibility to point to new locations of files.
I recommend doing a search inside the FEATURE folder for real life examples, as the dev team used feature upgrade for both v2v (12 > 14) and b2b (beta > rtm) upgrades.
Also read my whitepaper on upgrade as it contains info on upgrading solutions and features and code in general.
I also wrote an article on feature upgrade for DIWUG magazine.
I can also recommend Chris O'Brien's article series on feature upgrades.