BadImageFormatException C# [英] BadImageFormatException C#
问题描述
BadImageFormatException
未处理 - 尝试加载格式不正确的程序。 (从HRESULT
:0x8007000B的例外)
我应该如何解决?我几乎是积极的,我使用VS终端创建了.dll,它应该是与.NET框架相同的版本。如果需要,我也可以提供更多的代码。
谢谢!
确保你没有32位/ 64位冲突。
请参阅这个问题:
如果您在64位操作系统上运行,则Assembly RevitAPI可能会被编译为32位,并且您的进程为64位或任何CPU。
或者,RevitAPI编译为64位,您的进程编译为32位或任何CPU,并在32位操作系统上运行。
I'm using Visual C# Studio 10.0 with .NET Framework 4.0 and I was trying to load in the SoundTouchSharp library and create an instance of the library (object) in my application. However, after I type in the path for the file, I get this error:
BadImageFormatException
was unhandled -- An attempt was made to load a program with an incorrect format. (Exception fromHRESULT
: 0x8007000B)
How should I fix that? I'm almost positive that I created the .dll using the VS terminal and it should be the same version as the .NET framework. I can also provide more code if needed.
Thanks!
Make sure that you are not having 32-bit / 64-bit conflict.
Refer this question:
Troubleshooting BadImageFormatException
If you're running on a 64-bit OS, the Assembly RevitAPI may be compiled as 32-bit and your process as 64-bit or "Any CPU".
Or, the RevitAPI is compiled as 64-bit and your process is compiled as 32-bit or "Any CPU" and running on a 32-bit OS.
这篇关于BadImageFormatException C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!