在 Windows 7 计算机上编写/编译的 .NET 4 程序无法在 XP 上运行
我有一个在 Windows 7 Ultimate 计算机上的 Visual Studio 2010 中使用 C# .NET 4.0 编写的应用程序。该应用程序在 Vista 和其他 Windows 7 计算机上运行良好,但每当运行 Windows XP 的人尝试运行它时,它就会崩溃。
为了重现这个问题,我尝试在我的 Win XP VMWare 机器上运行它,但它在那里崩溃了。不幸的是,它没有给我任何具体的错误,只是通知我程序已崩溃并需要关闭。
另一位用户向我发送了以下内容:
Run-time error '339'
Component 'vbalSGrid6.ocx' or one of its dependencies not correctly registered: a file is missing or invalid.
Code 0xe0434352
Flags 0x00000001
当我尝试在 Virtual XP 计算机上运行它时,我没有得到该特定位,并且我还确保在那里安装了 .NET 4.0。
可能是什么原因造成的?如果 XP 支持 .NET 4 框架,为什么应用程序不能在 XP 中运行?
程序中用到的组件:DataGridView、ComboBox、Buttons、Labels、LinkLabel、NewtonSoft的JSON解析器,仅此而已。
我很困惑,完全不知道从哪里开始。有想法吗?
更新:嗯,尝试在 XP 上运行我最近创建的另一个应用程序,它加载得很好。两者之间唯一的主要区别(无论如何我使用的组件)是我对 NewtonSoft 的 JSON 库的使用,我实际上认为它是一个 .NET 3.5 组件。
更新2:只是为了好玩,我尝试在我的Wind7机器上以“Windows XP SP3”兼容模式运行该程序,并且运行良好。当然,我不知道“兼容模式”与真正的 XP SP3 环境的模拟有多接近,但我想无论如何我都会向您提供这些信息。
I have an app that I wrote using C# .NET 4.0 in Visual Studio 2010 on my Windows 7 Ultimate machine. This app works fine on both Vista and other Windows 7 computers, but whenever someone running Windows XP tries to run it it crashes.
In order to reproduce this I've tried running it on my Win XP VMWare machine and it crashes for me in there. Unfortunately it doesn't give me any specific error, just informing me that the program has crashed and needs to close.
One other user sent me the following:
Run-time error '339'
Component 'vbalSGrid6.ocx' or one of its dependencies not correctly registered: a file is missing or invalid.
Code 0xe0434352
Flags 0x00000001
I don't get that particular bit when I try to run it on my Virtual XP machine, and I also made sure to install .NET 4.0 on there.
What could be causing this, and why won't the app run in XP if the .NET 4 framework is supported for XP?
Components used in the program: DataGridView, ComboBox, Buttons, Labels, LinkLabel, NewtonSoft's JSON parser, and that's about it.
I am baffled and have utterly no idea where to start. Ideas?
UPDATE: Hmm, tried running my other recently created application on XP and it loaded fine. The only major difference (in the components I used anyway) between the two is my use of NewtonSoft's JSON library, which I actually think is a .NET 3.5 component.
UPDATE 2: Just for kicks I tried running the program on my Wind7 machine in "Windows XP SP3" compatibility mode and it ran fine. Of course, I have no idea just how closely the "compatibility mode" emulates a true XP SP3 environment, but I figured I'd give ya'll the info anyway.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是应用程序图标!
我一直注意到它在给我的错误中引用的模块是 system.drawing ,我认为这很奇怪。我认为可能是我使用的 PictureBox 导致了这个问题,所以我尝试禁用与此相关的所有内容,但无济于事。
我让我的业务合作伙伴设置了他的 XP 机器,这样除了我的 VMWare XP 机器之外,我们还有另一台机器可以进行测试,以防万一出现一些奇怪的问题。
在他完成设置并复制应用程序后,他说“这些图标看起来像 DOS 图标”,我灵光一现。
我使用 .PNG 作为图标,因为它们支持透明度等,但 XP 本身并不支持它们。因此,当应用程序被复制到桌面时,它只使用了一个通用图标,当应用程序运行时,它崩溃了,因为 XP 不知道如何渲染 .PNG。
¡¡ IT WAS THE APPLICATION ICON !!
I kept noticing that the module it referenced in the error it gave me was
system.drawing
which I thought was odd. I figured perhaps the PictureBox I was using was causing the issue, so I tried disabling everything to do with that, to no avail.I had my business partner set up his XP box so that we'd have another machine to test with aside from my VMWare XP box just in case there was some odd issue with it.
After he got it set up and the app copied over he said "The icons look like DOS ones" and I had a eureka moment.
I was using .PNG's as the icons because they support transparencies and whatnot, but XP doens't natively support them. So when the app was copied to the desktop it just used a generic icon for it, and when the application was run it crashed because XP doesn't know how to render a .PNG.
尝试使用 Fusion Log Viewer 调试 .NET 应用程序中的启动错误。
Scott Hanselman 编写了一个很好的操作方法,如果您需要深入了解,还提供了更多资源的链接。
Try using the Fusion Log Viewer to debug startup errors in .NET applications.
Scott Hanselman has written a nice howto along with links to further resources if you need to go deeper.
我们确定这是一些奇怪的 .NET 兼容性问题还是只是一个常见的错误安装/部署问题?
一位用户收到此错误消息是因为 OCX DLL 已使用短名称复制到 System32。将 DLL 重命名为正确的名称并运行 RegSvr32 解决了他的问题。
你有安装程序吗?您是否正确识别了所有托管和非托管依赖项并将它们正确地编写到您的安装程序中?
http://forums.elmsoftware.com/forum_posts.asp?TID=119
Are we sure this is some wierd .NET compatibility issue or just a run of the mill bad installer/deployment problem?
Here's one user who has that error message because the OCX DLL was copied to System32 with a shortname. Renaming the DLL to the correct name and running RegSvr32 resolved his problem.
Do you have an installer? Have you correctly identified all of your managed and unmanaged dependencies and properly authored them into your installer?
http://forums.elmsoftware.com/forum_posts.asp?TID=119