简体   繁体   English

未处理System.BadImageFormatException-简单修复

[英]System.BadImageFormatException was unhandled - simple fix

Here is a short video of my error. 是我的错误的简短视频。

It is obvious that I have something wrong between 32-bit and 64-bit. 很明显,我在32位和64位之间有问题。 However I cant find anything that holds my hand enough to walk through the solution in Visual Studio 2012. 但是,我找不到能握住手的任何东西来逐步解决Visual Studio 2012中的解决方案。

Can anyone give me a more detailed explanation of what and how to change in my settings? 谁能给我更详细的说明我的设置如何以及如何更改?

The "startup project" (the one that builds the .exe file) determines whether the process will run 32 or 64 bits. “启动项目”(构建.exe文件的项目)确定进程将运行32位还是运行64位。 Any library that is referenced must support the same "bitness". 引用的任何库都必须支持相同的“位”。

If you use libraries that requires a specific CPU type, you should change the "Target CPU" property in the "Build" tab of the project properties of the project that creates the main executable to that CPU type. 如果使用需要特定CPU类型的库,则应在创建该CPU类型的主要可执行文件的项目的“属性”选项卡中更改“目标CPU”属性。

Any managed library that you use, that does not depend on cpu-specific libraries can be compiled as "Any CPU". 您使用的任何不依赖于CPU特定库的托管库都可以编译为“任何CPU”。

I don't know the library you're using, but this link makes me think it requires a 32 bit build. 我不知道您正在使用的库,但是此链接使我认为它需要32位构建。

EDIT: I just realized I only know earlier versions of Visual Studio, so the option may be located elsewhere in 2012. 编辑:我刚刚意识到我只知道Visual Studio的早期版本,因此该选项可能位于2012年的其他地方。

I've dealt with a similar issue just a few days ago. 我几天前也处理过类似的问题。 It wasn't as straightforward as one would expect (given the error), I had to use dependency walker in order to check if all needed dependencies of my dlls were in the correct format, turned out my dll was importing an incorrect dependency. 它并不像人们期望的那么简单(给了错误),我不得不使用依赖关系遍历程序来检查我的dll所需的所有依赖关系是否都采用正确的格式,结果是我的dll导入了不正确的依赖关系。

Dependency Walker 依赖行者

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UNC路径和未处理的异常:C#中的System.BadImageFormatException - UNC Path and Unhandled Exception: System.BadImageFormatException in C# 未处理的异常:System.BadImageFormatException:无法加载文件或程序集 - Unhandled Exception: System.BadImageFormatException: Could not load file or assembly System.BadImageFormatException错误 - System.BadImageFormatException error Nunit System.BadImageFormatException - Nunit System.BadImageFormatException 错误:System.Windows.Forms.dll中发生未处理的“System.BadImageFormatException”类型异常 - Error: An unhandled exception of type 'System.BadImageFormatException' occurred in System.Windows.Forms.dll 未处理的异常:System.BadImageFormatException:尝试加载格式错误的程序 - Unhandled Exception: System.BadImageFormatException: n attempt was made to load a program with an incorrect format NaoQi和Leap问题:类型'System.BadImageFormatException'的未处理异常......并且无法加载文件或程序集 - NaoQi and Leap problems: An unhandled exception of type 'System.BadImageFormatException' … and Could not load file or assembly 未处理的异常:System.BadImageFormatException:无法加载从RoslynCompileSample加载的文件或程序集'0字节, - Unhandled Exception: System.BadImageFormatException: Could not load file or assembly '0 bytes loaded from RoslynCompileSample, 似乎无法修复:System.BadImageFormatException:无法加载文件或程序集“System.Data.SqlClient” - Can't seem to fix: System.BadImageFormatException: Could not load file or assembly 'System.Data.SqlClient' System.BadImageFormatException: '无法加载文件或程序集 - System.BadImageFormatException: 'Could not load file or assembly
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM