应用程序无法正确初始化 [英] Application Failed to Initialize Properly

查看:62
本文介绍了应用程序无法正确初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用vs2010构建的项目,该项目使用带有托管代码的.dll.我已经在vs2010中构建了.dll,目标框架是.NET 4.0(也尝试了Client Profile),这是2010年提供给您使用的唯一选项.当我运行它时,它无法初始化,并且我认为这是不兼容的……但是我不知道它会是什么.有人有什么想法吗?

We have a project built with vs2010 which utilizes a .dll with managed code. I've built the .dll in vs2010, target Framework .NET 4.0 (tried Client Profile as well), which is the only option 2010 gives you to use. When I go to run it, it can't initialize and I assume it's some incompatibility...but I have no idea what it would be. Does anyone have any ideas?

我还下载了一个修补程序,使您可以进行增量托管构建(最初在2010年不是功能)

Also, I have downloaded a hotfix which allows you to do Incremental Managed Builds (originally it wasn't a feature in 2010)

谢谢!

推荐答案

在64位版本的Windows上几乎总是生成异常0xc000007b(STATUS_INVALID_IMAGE_FORMAT).因为您的程序正在64位模式下运行,并试图加载包含非托管32位代码的DLL.或相反.

Exception 0xc000007b (STATUS_INVALID_IMAGE_FORMAT) is almost always generated on the 64-bit version of Windows. Because your program is running in 64-bit mode and trying to load a DLL that contains unmanaged 32-bit code. Or the other way around.

确保托管程序集是在平台目标"设置为任何CPU"的情况下构建的.这已不再是VS2010中的默认设置.项目+属性,构建"选项卡,平台目标设置.确保同时针对调试"和发布"配置进行更改.

Make sure the managed assembly was built with the Platform Target set to Any CPU. That isn't the default anymore in VS2010. Project + Properties, Build tab, Platform target setting. Be sure to change it for both the Debug and the Release configuration.

如果您不知道可能是哪个DLL,请观察程序使用SysInternals的ProcMon实用程序加载DLL的情况.

If you have no clue what DLL it might be then observe the program loading the DLL with the SysInternals' ProcMon utility.

这篇关于应用程序无法正确初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆