Could not load file or assembly ... or one of its dependencies. An attempt was made to load a progra

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-06-07T18:27:49Z Indexed on 2010/06/07 18:32 UTC
Read the original article Hit count: 185

Filed under:

I am getting the following error message when compiling or attempting to run my application on Windows 7 64 bit. I've scoured the internet and many people have the same error message however none of the solutions address my problem or situation.

Using VS 2010.

Error 38 Could not load file or assembly 'file:///D:/Projects/Windows Projects/Weld/Components/FileAttachments/FileAttachments/FileAttachments/bin/x86/Debug/FileAttaching.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. Line 1212, position 5. D:\Projects\Windows Projects\Weld\Weld\Weld.UI\frmMain.resx 1212 5 Weld.UI

Ok, so I have 2 projects a UI project and a FileAttachment project. UI project has a reference to FileAttachment project. When I compile UI project in "Any CPU" mode everything works fine and it runs. I assume 'Any CPU' will run in 64bit mode when I compile as that is the platform I am using.

I want to run/compile as x86 so I try to do that, so I change configuration for all projects to x86 and verify that these configurations are compiling to x86. I compile and get the error as stated above.

I find it odd that it compiles and works fine in 64bit but not 32bit. However when compiled and deployed to users as 'Any CPU', if these users have x86 it still works for them no problem. I just can't compile or run as x86 on my PC. Again, I can compile as Any CPU and deploy to a 32bit PC no problem.

Neither project are referencing any 64bit only dlls. Both projects are verified to be targetting 32bit dll's and .NET Framework assemblies.

I need to compile and run this locally under 32bit mode. I need JIT edit/continue among other things.

Here is the line of code in the resx file that is causing the problem:

 </data>

 <data name="Appearance17.Image"
 type="System.Drawing.Bitmap,
 System.Drawing"
 mimetype="application/x-microsoft.net.object.bytearray.base64">

 <value>

The resx file is verified to be generated for .NET 2.0 amnd is only referencing .NET 2.0 assemblies and not .NET 4.0 versions.

Any ideas here? I've searched the net and have found hundreds of people with the same error message but a different problem.

© Stack Overflow or respective owner

Related posts about .NET