vb.net mscorlib.dll 中出现“System.BadImageFormatException”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27711564/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 18:36:24  来源:igfitidea点击:

'System.BadImageFormatException' occurred in mscorlib.dll

.netvb.net

提问by Rob

I have a project that I want to refresh a bit, but it is no longer working as it once did.

我有一个项目想要刷新一下,但它不再像以前那样工作了。

It supports multiple languages (English, French, etc.), but I am now getting the following error: 'System.BadImageFormatException' occurred in mscorlib.dll at run time when it attempts to change languages cultures.

它支持多种语言(英语、法语等),但我现在收到以下错误: mscorlib.dll 在运行时尝试更改语言文化时发生“System.BadImageFormatException”。

This happens when it and its language res files / .dlls are built with the dot net framework version 3.5.

当它和它的语言 res 文件/.dlls 是用 dot net framework 版本 3.5 构建时会发生这种情况。

This does not happen if I change the language res files / .dlls to be built with the 4.5 dot net framework.

如果我更改要使用 4.5 点网络框架构建的语言 res 文件/.dll,则不会发生这种情况。

The language are res files are build as x86, I've tried both x86 and anycpu for the project - in various combinations but, again, it only works at runtime when using the dot net framework 4.5.

语言是 res 文件构建为 x86,我已经为该项目尝试了 x86 和 anycpu - 以各种组合,但同样,它仅在使用 dot net framework 4.5 时才在运行时有效。

The error gets thrown with this code:

使用此代码抛出错误:

System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo(My.Settings.Language)

I would like to use the dot net framework 3.5 for better OS backwards compatibility.

我想使用 dot net framework 3.5 以获得更好的操作系统向后兼容性。

Any ideas?

有任何想法吗?

Thanks in advance.

提前致谢。

回答by TiMeBaNDiT

The BadImageFormatException was usually thrown, if you use wrong x86 or x64 builds. If you switch to x86, have you done this for all the depend sources? Or have done this only for the starting project?

如果您使用错误的 x86 或 x64 构建,通常会抛出 BadImageFormatException。如果您切换到 x86,您是否对所有依赖源都执行了此操作?还是仅针对起始项目执行此操作?