tags:

views:

257

answers:

2

I have tried to do the following:

public abstract class MyItemEventReceiverBase : SPItemEventReceiver

public class TestItemEventReceiver : MyItemEventReceiverBase

It builds without a problem, but visual studio gives a error when I switch to the WSP View. The error is as follow: "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information." No further details regarding the actual issue.

So is it possible to create a base class that inherits from SPItemEventReceiver which can be used by ones custom list item event receiver classes?

+1  A: 

I had the exact same error! I even opened a ticket with Microsoft, I went through 5 people before the last guy sent me link to this page, note the sweet quote

Microsoft does not offer technical support for these extensions

Anyways, enough rant, the problem was you can't have your base class in a different assembly. I created a webpart base class in my web assembly and tried to inherit from it in my site template assembly. no go. So make sure the base class is in the same assembly.

(I came across another post that said it will work if your base class is in the GAC prior to opening VS2008, but I never tried)

Cube Pirate
Yip, I got arround the problem by adding the assemblies to the GAC via a post build script. Seems to work but causes so many issues, you always have to make sure that the assemblies are updated in the GAC. VS does funny things as well, not always the latest version in memory.
Schalk
A: 

For experimental purposes: does the error occur without the base class being abstract?

ROXORITY SharePoint Web Parts
Yes the error occurs without the base class being abstract
Cube Pirate