解决”应用程序配置不正确,程序无法启动”问题

问题背景

基于mfc开发的程序在发布或是在没有安装vs环境的机器上运行时,会报“应用程序配置不正确,程序无法启动”类似这样的错误,根本原因就是没有对应的依赖库文件或是版本不对。

问题分析、解析

解决的方法是先找出依赖的哪些文件,在编译程序的目录下查找 *exe.intermediate.manifest文件,文件的内容可能长这样

<?xml version=’1.0′ encoding=’UTF-8′ standalone=’yes’?>
< assembly xmlns=’urn:schemas-microsoft-com:asm.v1′ manifestVersion=’1.0’>
 <dependency>
    <dependentAssembly>
      <assemblyIdentity type=’win32′ name=’Microsoft.VC80.CRT’ version=’8.0.50727.762′ processorArchitecture=’x86′ publicKeyToken=’1fc8b3b9a1e18e3b’ />
    </dependentAssembly>
 </dependency>
 <dependency>
    <dependentAssembly>
      <assemblyIdentity type=’win32′ name=’Microsoft.VC80.MFC’ version=’8.0.50727.762′ processorArchitecture=’x86′ publicKeyToken=’1fc8b3b9a1e18e3b’ />
    </dependentAssembly>
 </dependency>
 <dependency>
    <dependentAssembly>
      <assemblyIdentity type=’win32′ name=’Microsoft.VC80.DebugCRT’ version=’8.0.50727.762′ processorArchitecture=’x86′ publicKeyToken=’1fc8b3b9a1e18e3b’ />
    </dependentAssembly>
 </dependency>
< /assembly>

需要注意这个文件中的3个关键词:Microsoft.VC80.CRT,Microsoft.VC80.MFC和Microsoft.VC80.DebugCRT。寻找到….”Program Files”Microsoft Visual Studio 8″VC”redist文件夹下面,找到这些名称的子文件夹,拷贝它们下面所有的文件到希望发布的EXE文件下面,一起打包。这些文件也就是mfc80.dll,msvcr80.dll,msvcp80.dll和Microsoft.VC80.CRT.manifest等。

当把相关的文件拷贝完整,一块发布后,一切运行正常。

查看原文

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值