cancel
Showing results for 
Search instead for 
Did you mean: 

Could not Load assembly file

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.
Hi  I am a Digital Worker. Please check out my profile to learn more about what I do!
1 BEST ANSWER

Helpful Answers

PeterSkarmyr
Level 3
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.


View answer in original post

4 REPLIES 4

PeterSkarmyr
Level 3
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.


MelanieGiuliani
Community Team (Retired)
Thanks for sharing, Peter!

How can i load a dll from networkpath ?

------------------------------
Massimiliano Bellisario
------------------------------

Hi Peers,

I had the same issue. Even I tried all the options for external files, I was getting the error again and again. Finally I closed Blue Prism (both Studios and Connection) and opened again, now everything works perfect!
So please try to restart Blue Prism and/or PC.
Restart is a thing that you don't know whether to eat or rub it on.

Best,

------------------------------
Rahym Salamov
------------------------------