问题描述
我使用Visual C#Studio的10.0与.NET Framework 4.0中,我试图加载在 SoundTouchSharp 的图书馆,在我的应用程序中创建库(对象)的一个实例。然而,当我输入该文件的路径,我得到这个错误:
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
是未处理的 - 试图用不正确的格式加载程序。 (异常来自 HRESULT
:0x8007000B)
我应该如何解决呢?我几乎可以肯定的是我创建使用VS终端.dll文件,它应该是同一版本的.NET框架。如果需要,我也可以提供更多的code。
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.
谢谢!
推荐答案
请确保您没有32位/ 64位的冲突。
Make sure that you are not having 32-bit / 64-bit conflict.
请参考这个问题:
Troubleshooting BadImageFormatException
如果您是在64位操作系统上运行,大会RevitAPI可以编译为32位和你的过程,64位或任何CPU。
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".
或者,RevitAPI被编译为64位和流程被编译为32位或任何CPU,并在32位操作系统上运行。
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#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!