Referencing ImageMagick.NET for use from a BPM

Anyone has any experience with using the ImageMagick library from Epicor/Kinetic?

I had an old external DLL which has been converted to BPMs and Epicor Functions for Kinetic 2023.2. I obtained the Nuget package and built a dummy Netstandard2.1 app with it, which produced the following reference files:

  • Magick.NET-Q16-AnyCPU.dll
  • Magick.NET.Core.dll
  • Magick.Native-Q16-x64.dll

The first two are valid .NET libraries, but they in turn reference a native C++ library, which is the third one. I deployed all three to the Assemblies folder on the server, and I am able to reference the first two, and the BPM code does compile. However at runtime I get the following exception:

Server Side Exception

BPM runtime caught an unexpected exception of 'TypeInitializationException' type.
See more info in the Inner Exception section of Exception Details.

Exception caught in: Epicor.ServiceModel

Error Detail 
============
Correlation ID:  fd185775-d41c-4d11-b156-0b6cdf04bedc
Description:  BPM runtime caught an unexpected exception of 'TypeInitializationException' type.
See more info in the Inner Exception section of Exception Details.
Inner Exception:  Unable to load DLL 'Magick.Native-Q16-x64.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
Program:  Magick.NET-Q16-AnyCPU.dll
Method:  .ctor

I have tried every which way to deploy these files (in \Bin, in \Assemblies, even in System32…), but nothing seems to work, and I am at a loss why… I do not know where its looking for the native DLL.

I also tried to install every Visual C++ redistributable I could find, and rebooting the server, to no avail…

Anyone has any idea?

Nevermind, figured it out… For posterity, the two managed DLLs go into Server\Assemblies, but the native DLL goes into Server\Bin\runtimes\win-x64\native.

Ok, now that your issue is sorted, please share with the class what you are doing with it. Sounds intriguing.

Deer Popcorn GIF

Nothing interesting, converting PDF pages to images, overlaying stuff, merging, etc… TBH I don’t even know what the output is supposed to look like, I’m just porting…