SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having a problem while activating a feature. I have a custom dll that I referenced in this new project, and I'm trying to execute some code on the feature activation. The problem is that I get the following error when I deploy it to the farm:

Error occurred in deployment step 'Activate Features': Could not load type 
'CustomDll.Type' from assembly 'CustomDll, Version=, 
Culture=neutral, PublicKeyToken=123456789123'.

Some points of interest:

-I can use the class that hasn't been found in other parts of the application, like in Application pages with no problems at all.

-I can run this code on FeatureDeactivating and it will work normally too.

-I'm trying to set a static List< T > inside a static class that is in the referenced dll. Maybe this could have something to do with the issue.

-The dll exists, and another SharePoint application deploys it to GAC.

What am I doing wrong? Any help is greatly appreciated.

share|improve this question

Your error indicates that you are deploying via Visual Studio. My guess would be that the references to the dependent dll are local to the project, not the GAC. Ensure the property "Copy Local" on the reference is set to false.

share|improve this answer
+1. The "Copy Local" property is set to false, but with your answer I discovered that the issue only happens when I deploy with visual studio. If I Package the solution and deploy it via stsadm it works fine. – Alexandre Machado Mar 21 '13 at 13:58

Maybe you received the TypeLoadException because you forgot to add the referenced assembly to the "Additional Assemblies" of your package.

To do this double click the package item in your SharePoint project -> "Advanced" -> "Add" -> "Add Assembly from Project Output...".

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.