本文介绍了BadImageFormatException C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual C#Studio 10.0与.NET Framework 4.0,我正在尝试加载在 SoundTouchSharp 库,并在我的应用程序中创建一个库(对象)的实例。但是,在我输入文件的路径后,我收到这个错误:

我应该如何解决?我几乎是积极的,我使用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:

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#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 22:44