If you have ever created a SPFeatureReceiver class, you might have noticed, that there is no “FeatureActivating”. So what do you do to cancel an activation of your feature?
Just throw an exception within FeatureActivated. This will cancel the activation process, and not activate the feature.
throw new SPException(“The feature could not be activated.");