1

I created an Event Receiver for a feature, my problem is when I deploy the solution, the feature is deployed as active but never goes through my FeatureActivated() inside my Event Receiver.

It also does not goes through feature deactivated when I retract the solution.

3
  • 1
    Note: Feature Deactivated is never called when you retract a solution via Central Admin or STSADM/PowerShell (unless retracted with Visual Studio, which deactivates Features before retracting).
    – James Love
    Feb 27, 2012 at 18:58
  • I am Deploying / Retracting with visual studio. Works fine if i do it manually. Feb 27, 2012 at 19:09
  • I have the same problem. i can fire the event recever when activate the feature manually but the event receiver did not fire with only deploying the solution. Do You Have Any Idea?
    – user7739
    Apr 24, 2012 at 17:45

2 Answers 2

1

Not sure about the scope & deployment of your feature (farm/web/site) but check the Feature Element for the value of 'ActivateOnDefault'.

These blog posts can be helpful for more information - SharePoint feature’s ActivateOnDefault attribute. and “Activate on Default” confusion and features scoped at Web Application level.

0

Besides sbc111's validation steps, are you sure that your handler (prior version) is not still attached? Use SP-Manager 2010 to see if by any chance you don't have multiple versions (people use feature activation/deactivation to attach/remove events - particularly if these are attached to lists, rather then content types).

C:\Marius

1
  • good point.. having 'orphaned' event receivers are quite common. Apr 24, 2012 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.