0

I'm using a service which requires that you implement a class ServiceHelper, and make it avaliable by placing a with an assembly reference in the webconfig's appsettings.

The ServiceHelper class resides in project MySolution.MyServiceProject, in the namespace MySolution.MyServiceProject.Helpers. The project is compiled into MySolution.MyServiceProject.dll

So I've added the following key

<add key="ServiceHelper" value="MySolution.MyServiceProject.Helpers.ServiceHelper, MySolution.MyServiceProject.dll"/>

Even though the dll has been copied to GAC, bin and Sharepoint root, the dll can't be loaded and causes the exception

"Could not load file or assembly 'MySolution.MyServiceProject.dll' or one of its dependencies. The system cannot find the file specified."

Any ideas why it can't be found?

Details: -The service implementation calls Assembly.Load("MySolution.MyServiceProject.dll") when trying to load the assembly. -I've attempted to write the key value bot with or without the ".dll" file name. Makes no difference - Iv'e tried writing the key value as the FULL assembly name (including version and publicKeyToken) - that causes a format exception which says that the format is incorrect and claims that you should only need to specify the assembly name and nothing else.

0

Try using Assembly.Load("MySolution.MyServiceProject, Version=X.X.X.X, Culture=XXX, PublicKeyToken=XXXX") or Assembly.LoadWithPartialName("MySolution.MyServiceProject")

  • Both solutions worked so problem solved! But does this mean that Assembly.Load simply is not capable of loading DLLs if you don't specify their FULL names? Weird...I'm sure I've managed to use it without having to specify the full name before.. – Drkawashima Nov 4 '12 at 1:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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