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

When deploying .dlls to the bin directory using a .wsp my feature receivers seem to blow at the deploysolution stage as they cannot find the related code for my feature receivers.

How can I handle this?

share|improve this question

2 Answers 2

I'm pretty sure that if your assemblies contain feature receivers then they need to be installed into the GAC.

There is a post about it here, but in my opinion it doesn't give a good explanation why.

My theory is that when you attach a feature receiver to a feature, the assembly needs to be globally available, since FeatureInstalled/Activated etc can be run from outside the WebApplication that the solution is deployed to.

What I mean is that when you deploy a solution to a web application and the assemblies are added to the /bin for the web app, the assemblies are visible only to that web app.

However, if you use stsadm to install or activate a feature, stsadm doesn't know about the assembly in the /bin and will fail (if a feature receiver needs to be run).

Similarly, when using Central Admin to deploy a solution, features are installed within the context of the central admin web application. If the feature receivers aren't visible to the central admin web app, then again this will fail.

Hope that makes sense.

share|improve this answer

If you think about it there are several reasons why a Feature Receiver would have to be installed in the GAC.

  • What would happen if you had the code linked to a Farm scoped feature?

  • How could stsadm execute feature activation if the code was only available to a given web application.

So yes you need to seperate your feature receiver code into a dll which will be deployed to the GAC.

share|improve this answer
    
That's what I was thinking too. Even a WebApplication scoped feature isn't activated from within the web application itself, it's done either through central admin or stsadm. –  Paul Lucas Mar 24 '10 at 14:05

Your Answer

 
discard

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