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

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=1.0.0.0, Culture=neutral, PublicKeyToken=a1f5b6162220ad3f. Additional information is below. : Could not load file or assembly 'IconExtractor, Version=1.0.0.0, 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???

share|improve this question
    
Double check the build settings, make sure it's set to "Any CPU". –  James Love Mar 7 '11 at 10:12
    
Yep its set to "Any CPU". Do I need to do anything else like add an elements file or something? –  user2548 Mar 7 '11 at 10:27
    
You say that it has not been deployed to the GAC - where have you deployed the assembly? –  Wictor Wilen MCA MCM MVP Mar 7 '11 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

share|improve this answer

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

share|improve this answer
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 Mar 7 '11 at 11:08

Your Answer

 
discard

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