I have a Sharepoint 2010 solution with project containing a custom content type, list definition and list instance in. In this solution is an event receiver project and a standard class library project "IconExtractor" that contains code to be shared with the event receiver and a web part project (yet to be added).

The problem is that when the code in the IconExtractor dll project is executed by the event reciever the following error is recorded in the ULS log:

Error loading and running event receiver HLSAppEventReceiver.EventReceiver1.EventReceiver1 in HLSAppEventReceiver, Version=, Culture=neutral, PublicKeyToken=a1f5b6162220ad3f. Additional information is below. : Could not load file or assembly 'IconExtractor, Version=, Culture=neutral, PublicKeyToken=678bf53af6dec8bb' or one of its dependencies. The system cannot find the file specified.

Why can my dll not be loaded by sharepoint. It has a strong name but has not been deployed in the gac or anything like that. How do I create a Sharepoint friendly dll???

  • Double check the build settings, make sure it's set to "Any CPU".
    – James Love
    Commented Mar 7, 2011 at 10:12
  • Yep its set to "Any CPU". Do I need to do anything else like add an elements file or something?
    – user2548
    Commented Mar 7, 2011 at 10:27
  • You say that it has not been deployed to the GAC - where have you deployed the assembly? Commented Mar 7, 2011 at 11:39

2 Answers 2


Ok, one answer is to deploy the dll to the GAC using a post-build event:

"c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\x64\gacutil.exe" /if iconextractor.dll


One thing to check (I know I've made this mistake) is that The assembly is targeted for .Net 3.5, not .Net 4.

  • 1
    Yep is already targeted to 3.5 :-) I'm going to try and add the assembly to the GAC and see if that works...
    – user2548
    Commented Mar 7, 2011 at 11:08

Your Answer

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