Error when referencing external DLL

Hi,

I am attempting to create a new page in CRM using a custom .Net dll which will allow our users to hook into the Docusign API. When I attempt to send the document to the API I the dll throws an exception stating that 'Could not load file or assembly 'DocuSign.eSign, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.'

Has anyone else had a problem similar to this, and if so how did you resolve this?

Thanks in advance for your help

  • 0

    Can you turn the .net logging in CRM to full, then recreate the error and post up the log file?

  • 0

    Hi Toby,

    Here are the relevant parts of the log file:

    Feb 4 2016 14:30:22.436 8104 5284 5 Set WebPage object reference.

    Feb 4 2016 14:30:22.437 8104 5284 5 Loading CRM Interfaces:

    Feb 4 2016 14:30:22.437 8104 5284 5 LOADING MAIN INTERFACES

    Feb 4 2016 14:30:22.439 8104 5284 5 Got assembly: DocusignTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

    Feb 4 2016 14:30:22.439 8104 5284 5 EntryPoint - Initializing dotnet objects

    Feb 4 2016 14:30:22.439 8104 5284 5 Type: DocusignTest.AppFactory, BaseClass: System.Object

    Feb 4 2016 14:30:22.439 8104 5284 5 Is Class: True; Is AppFactory: True

    Feb 4 2016 14:30:22.439 8104 5284 5 AppFactory found

    Feb 4 2016 14:30:22.440 8104 5284 5 Invoking Method: RunSendDocumentPage; DLL: DocusignTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

    Feb 4 2016 14:30:22.440 8104 5284 5 Casting the Method result to Sage.CRM.WebObject.Web

    Feb 4 2016 14:30:22.440 8104 5284 5 Before invoke BuildContents

    Feb 4 2016 14:30:22.517 8104 5284 5 Unloading Domain

    Feb 4 2016 14:30:22.518 8104 5284 5 NET - BASE RELEASE CORE INTERFACES

    Feb 4 2016 14:30:22.518 8104 5284 5 Metadata Unload.

    Feb 4 2016 14:30:22.519 8104 5284 5 Keys Unload.

    Feb 4 2016 14:30:22.519 8104 5284 5 UserSession Unload.

    Feb 4 2016 14:30:22.519 8104 5284 5 Dispatch Unload.

    Feb 4 2016 14:30:22.519 8104 5284 5 Unloading WebPage

    Feb 4 2016 14:31:05.127 8104 5284 5 Set WebPage object reference.

    Feb 4 2016 14:31:05.127 8104 5284 5 Loading CRM Interfaces:

    Feb 4 2016 14:31:05.128 8104 5284 5 LOADING MAIN INTERFACES

    Feb 4 2016 14:31:05.129 8104 5284 5 Got assembly: DocusignTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

    Feb 4 2016 14:31:05.130 8104 5284 5 EntryPoint - Initializing dotnet objects

    Feb 4 2016 14:31:05.130 8104 5284 5 Type: DocusignTest.AppFactory, BaseClass: System.Object

    Feb 4 2016 14:31:05.130 8104 5284 5 Is Class: True; Is AppFactory: True

    Feb 4 2016 14:31:05.131 8104 5284 5 AppFactory found

    Feb 4 2016 14:31:05.131 8104 5284 5 Invoking Method: SendDocument; DLL: DocusignTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

    Feb 4 2016 14:31:05.131 8104 5284 5 Casting the Method result to Sage.CRM.WebObject.Web

    Feb 4 2016 14:31:05.131 8104 5284 5 Before invoke BuildContents

    Feb 4 2016 14:31:05.212 8104 5284 5 Unloading Domain

    Feb 4 2016 14:31:05.213 8104 5284 5 NET - BASE RELEASE CORE INTERFACES

    Feb 4 2016 14:31:05.213 8104 5284 5 Metadata Unload.

    Feb 4 2016 14:31:05.213 8104 5284 5 Keys Unload.

    Feb 4 2016 14:31:05.213 8104 5284 5 UserSession Unload.

    Feb 4 2016 14:31:05.214 8104 5284 5 Dispatch Unload.

    Feb 4 2016 14:31:05.215 8104 5284 5 Unloading WebPage

    The way I am running this is that I call one page (RunSendDocumentPage) which is created in the dll, and then from a button on there I call the second page (SendDocument), it's on this second page where I am getting the error.

  • 0

    To rule out it being DLL specific I tried the same thing with the AMS.Profile.dll and a simple test method and had the same issue. However when I tried it with a Sage 200 dll it seemed to work correctly.

    I'm wondering if it's something to do with the .Net framework which they are targeting. Do CRM dlls need to target .Net 3.5 in the same way Sage 200 does?

  • 0

    I have found a work around for my issue. The way I did this was to install the dll to the GAC (Global Assembly Cache). To do this I used the developer command prompt which can be found in your 'Visual Studio Tools' folder from your programs menu.

    Using the command below you should be able to install any assembly to the gac:

    GacUtil.exe /i "AssemblyPath.dll"

    You may run into an issue when using an external dll where it is not strongly named, whilst still in the developer command prompt you can follow the steps detailed hewww.geekzilla.co.uk/ViewCE64BEF3-51A6-4F1C-90C9-6A76B015C9FB.htm and this will recompile the dll with a strong name attached to it.

  • 0

    There is another option that we use a lot. You can use reflection to load the DLL's placed in the CustomDotNet folder at run time.

    Having to load DLL's into the GAC is problematic, especially when you want to redeploy your code via components etc.