什么可能导致 .resx 文件在 Windows XP 下正确编译,但在 Windows 7 64 位下失败并出现错误 137?

发布于 2024-10-16 01:33:52 字数 373 浏览 3 评论 0原文

我遇到了一个非常奇怪的情况。我的解决方案中有一个 .resx 文件导致出现问题。

使用在 Windows XP 下运行的 Visual Studio 2010,该解决方案可以顺利编译。

使用在 Windows 7 64 位下运行的 Visual Studio 2010,相同的解决方案报告生成失败,并显示错误 137

尝试加载格式不正确的程序。第 204 行,位置 5。 [Path Sanitized]\RemoteFileView.resx

有问题的资源文件似乎是有效的,因此我无法解释该问题。

谁能建议可能出了什么问题?

澄清:VS 2010 抱怨的问题行是一个简单的 元素。 XML 看起来格式良好。

I have run into a very strange scenario. There is a .resx file in my solution causing problems.

Using Visual Studio 2010 running under Windows XP, the solution compiles without problems.

Using Visual Studio 2010 running under Windows 7, 64 bit, the same solution reports a build failure with error 137

An attempt was made to load a program with an incorrect format. Line 204, position 5. [Path Sanitized]\RemoteFileView.resx

The resource file in question appears to be valid, so I am at a loss to explain the problem.

Can anyone suggest what might have gone wrong?

Clarification: The line in question that VS 2010 is complaining about is a simple </data> element. The XML appears to be well formed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

凌乱心跳 2024-10-23 01:33:52

根据错误消息中的字符串,有一个 BadImageFormatException当设计者尝试加载时被抛出。

这似乎很可能是位不匹配问题。您是否尝试过重建解决方案?您可以通过 MSBuild 在命令行上构建吗?您的所有项目是否都针对“任何 CPU”,或者您是否有特定于处理器的项目?

请查看 这篇博文,其中 Sara Joiner 详细描述了您可能会看到此问题的情况。

Based on the string in the error message, there is a BadImageFormatException being thrown when the designer is trying to load.

It seems highly likely that it's a bitness mismatch issue. Have you tried rebuilding the solution? Can you build on the command line via MSBuild? Are all of your projects targetting "Any CPU", or do you have a processor specific project?

Please take a look at this blog post where Sara Joiner describes the circumstances where you may see this issue in detail.

骄傲 2024-10-23 01:33:52

我在将系统迁移到 64 位时也遇到了同样的问题。对我来说唯一的解决方案是每次我在 gui 中更改某些内容并更新 resx 文件时,我都必须执行以下操作:

将所有出现的字符串 j00L 替换为 j0yL代码>.

您现在就可以编译了!

I also had the same issue when migrating my system to 64-bit. The only solution for me was that every time I changed something in the gui and the resx-files updated, I had to do the following:

Replace all occurences of the string j00L to j0yL.

You will now be able to compile!

许一世地老天荒 2024-10-23 01:33:52

这是 Visual Studio 的一个错误,微软已经知道一年多了。有关详细信息,请参阅以下链接:

我最近不得不升级我们的 Windows 窗体项目到.NET 4.0,因为一旦我们触摸(读取保存的)设计器,它就会破坏我们嵌入的图像。错误所在的行只是一堆废话。

不幸的是,所有建议的解决方法都不适合我们,所以我们不得不硬着头皮升级。

It's a bug with Visual Studio that microsoft has known about for over a year. See below links for more information:

I recently had to upgrade our windows forms project to .NET 4.0 because as soon as we touched (read saved) a designer it correupted our embedded images. The line of the error was just a load of bollocks.

Unfortunately none of the suggested workarounds worked for us so we had to bite the bullet and upgrade.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文