Digital Exchange Community

DX_Community_Banner.png
Expand all | Collapse all

Could not Load assembly file

Jump to Best Answer
  • 1.  Could not Load assembly file

    Posted 10-01-2019 21:01

    I am trying to remove password from pdf using C# code. Initially I tried with SPIRE.pdf and then Apitron.pdf.kit dlls.

    In both cases, the code was working fine in my laptop however if i try the same code using same library in my client machine, I am getting any error

    Could not load file or assembly Apitron.PDF.Kit Version=2.0.21.0 Culture=neural, Public Key Token=6e759db or one of its dependencies. The system cannot find the file specified.

    I am writing C# code in Blue Prism

    Please someone advice the cause of the issue.

    --------------------------------------------------
    Disclaimer: This content was auto-posted from Stackoverflow. The original Stackoverflow question is here Stackoverflow Post, posted by Divakar Ragupathy.


  • 2.  RE: Could not Load assembly file
    Best Answer

    Posted 10-02-2019 07:56
    Edited by Peter Skarmyr 10-02-2019 21:15
    Hi

    I have had this issue as well. I got the following answer from support about using external DLLs.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Pre-Requisites
    It is recommended that you have a good coding knowledge before attempting to utilise any of the information provided below. Blue Prism requires the following before being able to use external code:-
    • The file must be in a location that Blue Prism can access 
    • The user account which attempts to load the DLL file must have at least Read Access to the location that the file is stored in 
    Locations for external files
    The following locations are typically accessible to Blue Prism, and are checked in this sequence:- 
    1. The directory where the Blue Prism “automate.exe” executable file is located. 
    2. The current directory. 
    3. The Windows system directory. The %windir%\system variable retrieves the path of this directory for 64-bit files on a 64-bit OS, and 32-bit files on a 32-bit OS. For 32-bit files hosted on a 64-bit OS the directory is %windir%\SysWOW64 
    4. The Windows directory. The %windir% variable retrieves the path of this directory. 
    5. The directories listed in the %PATH% environment variable. The ‘path’ command lists the full set of directories currently set. 
    6. In the .NET Framework Global Assembly Cache.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Option 1 works well given that your current directory is the folder where automate.exe is located. For your blue prism application shortcut, go to properties and check the "start in" is set to the folder where automate.exe is located. Make sure your dll is located in the same folder as automate.exe and in you object you should reference the dll-file only by name, not the full path. You can make a process in blueprism to deploy the dll-files to the automate.exe folder.

    I could not get option 2-5 to work.

    Option 6 works but it is a bit inconvenient. You can use something like innosetup to add dlls to GAC.

    Option 1 works best in my opinion.

    Another thing that can cause this issue is that your dll has dependencies to other dll files. Then you need to also place the dependencies in the same folder as automate.exe.





  • 3.  RE: Could not Load assembly file

    Posted 10-02-2019 21:15
    Edited by Melanie Giuliani 10-02-2019 21:15
    Thanks for sharing, Peter!