BadImageFormatException C#[重复](BadImageFormatExcep

2019-08-21 03:47发布

This question already has an answer here:

  • Could not load file or assembly … An attempt was made to load a program with an incorrect format (System.BadImageFormatException) 23 answers

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 from 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.

Thanks!

Answer 1:

请确保你没有32位/ 64位的冲突。

转问这个问题:

故障排除BadImageFormatException

如果你在64位操作系统上运行,大会RevitAPI可以编译为32位和你的过程,64位或“任何CPU”。

或者,RevitAPI编译为64位和你的过程被编译为32位或“任何CPU”,并在32位操作系统上运行。



文章来源: BadImageFormatException C# [duplicate]
标签: c# .net dll