The Art of SharePoint Evolution

Stories from a SharePoint Engineer that isn’t afraid of Visual Studio.

Custom SharePoint Event Handlers not Updating on New Visual Studio Builds

with 3 comments

That wasn’t too descriptive was it? Not sure if this has been documented anywhere else but I came across a quirk today while I was trying to create custom Event Handlers for a Document Library.

Environment:
Windows 2003
MOSS 2007
Visual Studio 2008
Visual Studio SharePoint Extension Kit 1.2

Scenario:
Using the EventReceiver SharePoint template in Visual Studio, I started out with the ItemUpdating method and deployed some code a few times and then decided to switch to using the ItemUpdated method instead. For a dozen builds or so after that I couldn’t figure out whether or not my code was working or the ItemUpdated event was even firing. When I switched back to the ItemUpdating method, it worked as expected even with new code. Switched back to ItemUpdated and no good, no events fired even after IIS resets.

Solution:
Finally I decided to remove the event handler manually by doing the following:

- deactivated the feature
- retracted the solution
- deleted the solution
- deleted the dll in the GAC
-IISReset

Then after rebuilding/redploying the solution everything worked just as expected. Woohoo!

Written by Henry

October 3, 2008 at 9:02 pm

3 Responses to 'Custom SharePoint Event Handlers not Updating on New Visual Studio Builds'

Subscribe to comments with RSS or TrackBack to 'Custom SharePoint Event Handlers not Updating on New Visual Studio Builds'.

  1. I have had this problem in the past also. Sometimes clearing the whole thing out helps. I’ve actually found sometimes the error still persists.
    With Event Receivers, I’ve also found SharePoint Inspector helpful as you can see visually whether the Event Receiver is actually attached to the list and for what type of event e.g. updated or updating. You can also actually remove them off the list here too!
    I also tend to clean up after myself with Features too, so that when you deactive the feature it removes the event receiver from the list - that’s if you are attaching it using the elements manifest way or in api on activating.

    Jeremy Thake

    3 Oct 08 at 9:18 pm

  2. Awesome tips, thanks Jeremy!

    Henry

    6 Oct 08 at 9:40 pm

  3. Thanks for sharing your scenario. I always use step 1-3 (of your solution) for custom event handlers and that works for me.

    Dennis

    14 Oct 08 at 1:15 am

Leave a Reply