0

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.");
    }
Shankar
  • 448
  • 3
  • 9
  • 34

2 Answers2

2

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.

Sylvain Reverdy
  • 2,468
  • 3
  • 16
  • 14
0

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.

Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
  • I am using the force command...stsadm -o deactivatefeature -filename folder/feature.xml -url http://server-name/ -force... i will try to trace the error – Shankar May 06 '11 at 05:18