If I have a WSP containing a feature that on PROD environment has been upgraded from it's initial 0.0.0.0 version to 1.0.0.0 and then 2.0.0.0, and which has had custom code activated in the FeatureUpgrading event handler, if I were to take that WSP from PROD and deploy it to UAT, would all the code in the FeatureUpgrading handler be run? I ask because I believe that deploying a WSP in itself does not run feature activation. A PowerShell script needs to be run to update the feature.
So given the code below, would simply deploying the WSP run that code?
Thanks
public override void FeatureUpgrading(SPFeatureReceiverProperties properties, string upgradeActionName, System.Collections.Generic.IDictionary<string, string> parameters) { SPSite sitecollection = (SPSite)properties.Feature.Parent as SPSite; SPWeb RootWeb = sitecollection.RootWeb; switch (upgradeActionName) { case "Version1Updates": Version1Updates(properties, RootWeb, sitecollection); break; case "Version2Updates": Version2Updates(properties, RootWeb, sitecollection); break; default: // Log that code for action does not exist. break; } } #region Version 1.0.0.0 updates private void Version1Updates(SPFeatureReceiverProperties properties, SPWeb RootWeb, SPSite sitecollection) { //run some code
} private void Version2Updates(SPFeatureReceiverProperties properties, SPWeb RootWeb, SPSite sitecollection) { //run some code
}
Maz