BadImageFormatException C#
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15917204/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
BadImageFormatException C#
提问by m00nbeam360
I'm using Visual C# Studio 10.0 with .NET Framework 4.0 and I was trying to load in the SoundTouchSharplibrary 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:
我正在使用带有 .NET Framework 4.0 的 Visual C# Studio 10.0,我试图加载SoundTouchSharp库并在我的应用程序中创建库(对象)的实例。但是,在输入文件路径后,出现此错误:
BadImageFormatException
was unhandled -- An attempt was made to load a program with an incorrect format. (Exception fromHRESULT
: 0x8007000B)
BadImageFormatException
未处理 -- 尝试加载格式不正确的程序。(例外HRESULT
: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.
我该如何解决?我几乎肯定我使用 VS 终端创建了 .dll,它应该与 .NET 框架的版本相同。如果需要,我还可以提供更多代码。
Thanks!
谢谢!
采纳答案by Freelancer
Make sure that you are not having 32-bit / 64-bit conflict.
确保您没有 32 位 / 64 位冲突。
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".
如果您在 64 位操作系统上运行,则 Assembly RevitAPI 可能会编译为 32 位,而您的进程可能会编译为 64 位或“任何 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.
或者,RevitAPI 编译为 64 位,您的进程编译为 32 位或“任何 CPU”并在 32 位操作系统上运行。