In SharePoint 2010 it is well known that features can be versioned and upgraded accordingly.
This is well described in the following MSDN documentation:
Surprisingly, upgrading features requires calling the SPFeature.Upgrade() method of any feature that need to be upgraded.
Chris O’Brien provides a set of tutorials that illustrate how to upgrade features in SharePoint and I recommend his posts
Chris also provide a nice tools (as well as a Powershell commandlet) to visually upgrade features.
It is less known that calling SPFeature.Upgrade() is not necessary (and not supported) in the Sandbox : when we upload a new solution package with a different name, but with the same solution Id, the features will automatically be upgraded.
To illustrate this, let’s create a Visual Studio 2010 Sandbox project called DemoUpgradeSandBox; add a web part to have a feature and set the feature version property to 220.127.116.11.
Deploy the solution with Visual Studio 2010 and make sure the solution package is deployed and activated to the solution gallery.
Now, let’s change our feature version number to 18.104.22.168
Open the feature Manifest :
Add the following Upgrade Action:
Add a feature Receiver, to handle the upgrade by code :
Uncomment the FeatureUpgrading() method :
Build the project, rebuild the package, rename the package on the file system :
In Visual Studio 2010 set a breakpoint in the FeatureUpgrading method(), and attach the project to the sandbox host process (SPUCWorkerProcess.exe) :
Upload the new package into the solution gallery; since the same solution Id is used, SharePoint will ask you to upgrade :
Click on upgrade and you will hit the breakpoint in Visual Studio :