I am developing on a Windows 7 64bit machine. I have a solution in Visual Studio using C# and am trying to add the solution for ImageMagick I found here to my project.
I managed to add the solution to my project, checked the linker and c/c++ general settings as well as the common properties and all appears to be in order. I also added a reference in my project to ImageMagickNET8 (the name of the ImageMagick project).
When I try to make a ca开发者_Python百科ll to the ImageMagick project: ImageMagickNET.Image img = new ImageMagickNET.Image("c:\picture.jpg");
...the following exception is thrown: BadImageFormatException was unhandled Could not load file or assembly 'ImageMagickNET8, Version=1.0.4189.18742, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I assume I am forgetting something fundamental about adding a project to my existing project.
It's likely that ImageMagick is set to compile to x86 only, instead of Any CPU. Try changing your project to be x86. Project + Properties, Build tab, Platform target setting.
精彩评论