VC2005-应用程序正常初始化失败-0xc0150002

来源:互联网 发布:medline数据库中文 编辑:程序博客网 时间:2024/06/02 16:48

今天将完成的程序放到干净的环境进行测试,启动程序时得到了The application failed to initialize properly(0xc0150002)的错误,在网上查了很多资料才得以解决,具体解决方式如下:

1. 检查应用程序的manifest文件中dependentAssembly的引用版本,如下:

    <dependentAssembly>      <assemblyIdentity type='win32' name=‘Microsoft.VC80.DebugCRT' version='8.0.50727.6195' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />    </dependentAssembly>

2. 在开发环境中的VC200X中找到Microsoft.VC80.DebugCRT文件夹,将其中的dll与manifest文件(Microsoft.VC80.DebugCRT.manifest)都拷贝到应用程序的根目录;

这样,程序就正常运行了。

本问题的原因在于:程序运行时,首先会查询编译阶段就已经存储在程序资源中的manifest记录,然后按照该记录提供的版本和名称去搜寻对应的相应库(如MFC、ALT、CRT等)以及随库发布的manifest文件(Microsoft.VC80.DebugCRT.manifest),搜索路径包括C:\\windows\winsxs,但如果目标机没有安装相应环境,则无法找到从而报错。

 

原创粉丝点击