Archived Forum Post

Index of archived forum posts

Question:

ImageList "Could not load assembly"

Dec 20 '12 at 15:22

I am getting the following error when I compile my project with ChilKat.

Error 1 Could not load file or assembly 'file:///C:/Program Files (x86)/Chilkat Software Inc/Chilkat.NET-v2.0-Framework/ChilkatDotNet2.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. Line 161, position 5. C:SourceChillKat2TestChillKat2TestForm1.resx 161 5 ChillKat2Test

All the searches say this is related to 32/64-bit DLL, but that is not the case here. This error occurs when I add an image to an ImageList and compile. I can do the following...

1.) Create empty project, add ChilKat reference (Compiles successfully) 2.) Add an image list to Form1 (Compiles successfully) 3.) Add an image to the image list (Fails to compile) 4.) Remove the image from the image list (Compiles successfully)

I have confirmed my project is linking to the 32-bit DLL, and that the platform is set to x86, not AnyCPU. I can reproduce this with a brand new empty project.


Answer

I did some Googling and found this:
http://blogs.msdn.com/b/visualstudio/archive/2010/06/18/resgen-exe-error-an-attempt-was-made-to-load-a-program-with-an-incorrect-format.aspx

Also see this:
http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/ac24d77e-7c3d-4d07-876e-fa9102d02456

and this:
http://stackoverflow.com/questions/9002707/compile-error-rg0000-incorrect-format-after-adding-images-to-an-imagelist

and this:
http://stackoverflow.com/questions/2992075/could-not-load-file-or-assembly-or-one-of-its-dependencies-an-attempt-was-m/3010603#3010603