Runtime error

Coordinator
Jun 26, 2013 at 7:38 PM
Copied from issue:

I've updated to the latest release via NuGet and I'm now getting the following runtime error:

System.BadImageFormatException: Could not load file or assembly 'Magick.NET-x64, Version=6.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'Magick.NET-x64, Version=6.0.0.0, Culture=neutral, PublicKeyToken=2004825badfa91ec'


I noticed when I tried adding a call to MagickNET.Initialize() I now get a compiler error telling me that everything is embedded. Does this mean that I no longer need ImageMagick installed at all? I've removed the ImageMagick folder just to be sure, be I am still getting this runtime error.

Thoughts on how to fix?
Coordinator
Jun 26, 2013 at 7:46 PM
You should not install ImageMagick, everything is included in the dll. So you don't need to call the Initialize method anymore. You will get a System.BadImageFormatException when you load a 64 bit dll in a 32 bit environment. Are you using the Q8 or Q16 version and in what kind of application are you using Magick.NET?
Jun 26, 2013 at 8:12 PM
Ahah! I had been using the x86 version at some point previously, and had set the "Platform target:" under "Build" to x86. Switched it to x64 and I'm good to go. Thanks so much for the quick reply. Also, I'm digging the fact that you have the dependencies from ImageMagick embedded now. Nice work!
Jun 26, 2013 at 9:22 PM
Well, I spoke too soon. It works fine on my machine, but when deploying my WinForm app to a server (a few users will RDP in to use the app), I get runtime errors again. I've tried deploying both x86 and x64 versions to two different servers running those respective architectures. Any suggestions on how to debug the binding failures?

Here's the latest error:

System.IO.FileNotFoundException: Could not load file or assembly 'Magick.NET-x64.dll' or one of its dependencies. The specified module could not be found.
Jun 26, 2013 at 9:31 PM
Edited Jun 26, 2013 at 9:32 PM
System.IO.FileNotFoundException: Could not load file or assembly 'Magick.NET-x64.dll' or one of its dependencies. The specified module could not be found.
I hadn't installed the VC++ runtime library on this particular server yet. After doing so, all is good!