feature deactivation through command line not firing the SPFeature event reciever

1.4k views Asked by At

I am deactivating a feature through stsadm tool. I have an event reciever enabled for this action. If i deactivate the feature manually from the site the event is getting triggered but not when running stsadm command.

Please help...

Here is the code Sylvain:

public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
    {
        Logging.Log(_componentName, "The document library feature has deactivated successfully.");
    }
2

There are 2 answers

1
Sylvain Reverdy On

In the code of your event receiver, do you use SPContext.Current (or other Web-Context objects)... ? If so, your code works on the site, but not out of web-context (like stsadm or command line) because SPContext.Current is null.

Check this point, but there's a good probability that's the problem.

1
Alexei Levenkov On

As Sylvain Reverdy pointing out it is more likley your feature receiver to fail than not beeing called. Check out SharePoint logs - all feature activation/deactivation/installation steps are traced there (Location - c:\Program Files\Common Files\Microsoft Shared\web server extensions\14\LOGS, see Where is the default log location for SharePoint/MOSS?).

Make sure you are not using "-force" option of StsAdm command - it makes stsadm to ignore failures during deactivation.