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?


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.


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.

  • 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
    Commented Mar 24, 2010 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.