Take the 2-minute tour ×

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

2 Answers 2

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


