Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
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 '12 at 18:58
    
I am Deploying / Retracting with visual studio. Works fine if i do it manually. –  Dr.Denis McCracleJizz Feb 27 '12 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 '12 at 17:45
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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

share|improve this answer
    
good point.. having 'orphaned' event receivers are quite common. –  Supriyo SB Chatterjee Apr 24 '12 at 21:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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