Creating SP 2007 Event Handler using WSPBuilder 2010 [SOLVED]

Aug 6, 2010 at 4:33 PM
Edited Aug 6, 2010 at 4:49 PM

To get it out of the way, I'm using Visual Studio 2008 with .NET Framework 3.5, SharePoint 2007 (WSS 3.0), and WSPBuilder 2010.

I'm familiar with WSPBuilder 1.0.6, but I have problems using it to create projects using .NET 3.5 Framework and getting them to deploy (in other words, they won't deploy if using .NET 3.5). Until recently, I haven't needed to use the .NET 3.5 Framework-- .NET 2.0 being sufficient to fulfill my needs, so I wasn't overly concerned with this issue. Now I need to use .NET 3.5 Framework and am still unable to get a .NET 3.5 Framework project to deploy using WSPBuilder 1.0.6, so I've upgraded to WSPBuilder 2010 Beta 1.4. With WSPBuilder 2010, I'm able to deploy a .NET 3.5 Framework project without a hitch, but I can't figure out how to create an SPItemEventReceiver event handler. I selected a Blank Feature, set up the elements.xml file, and wrote the code. Instead of inheriting the SPFeatureReceiver class, I inherited the SPItemEventReceiver class. Everything deploys fine, but when I try to activate my event handler, I get the following error:

Failed to create feature receiver object from assembly "Project_Name, Version=, Culture=neutral, PublicKeyToken=c119ba94634c2173", type "Project_Name.My_EventHandlerReceiver" for feature b68cf06a-1ccb-4852-a3f8-0920540f552a: System.InvalidCastException: Unable to cast object of type 'Project_Name.My_EventHandlerReceiver' to type 'Microsoft.SharePoint.SPFeatureReceiver'. at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()

Pretty sure my error is the class I'm inheriting (or not inheriting), but with almost zero info out there about WSPBuilder 2010, I'm not sure how to overcome this problem. Can anyone offer some guidance on creating SPItemEventReceiver event handlers?

Thanks in advance!

Aug 6, 2010 at 5:30 PM
Figured it out. Deleted the following two elements from my feature.xml file made it work like a champ: ReceiverClass and ReceiverAssembly.