关于vc++ 2005 发布程序的问题

           拿到一个第3方的dll, 写了一个简单的程序测试这个DLL, 但是程序一启动就遇到了下面的错误:  

The application failed to initialize properly (0xc0150002). Click on OK to terminate 
the application.  

            找到事件查看器,给出如下的提示:

EventID: 32
Description: Dependent Assembly Microsoft.VC80.CRT could not be found and Last Error was The referenced     
assembly is not installed on your system.
EventID: 59
Description: Resolve Partial Assembly failed for Microsoft.VC80.CRT. Reference error message: The    
referenced assembly is not installed on your system.
EventID: 59
Description: Generate Activation Context failed for Generate Activation Context
E:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll. Reference error message: The operation completed
successfully.

        在系统的C:\Windows\WinSXS 文件夹下搜索的相关的VC80.CRT和VC80.MFC文件(包括dll和manifest),放到程序的目录下,运行程序,还是出现0xc0150002的错误,检查事件查看器,错误变成了只有一下一条:

EventID: 59
Description: Generate Activation Context failed for Generate Activation Context
E:\tlh1987\vs2008projects\B3DTest\Debug\B3DViews.dll. Reference error message: The operation completed
successfully.
        在网上查找资料,说是安装 Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)能解决问题。安装之后发现还是不能解决。 最后找到了这篇文章http://social.msdn.microsoft.com/Forums/nb-NO/vssetup/thread/fa559cb7-eabc-4f41-a3bc-84ed7ae089fc 关键是下面这一段:

I recommend you install Visual C++ 2005 SP1 Redistributable which version is 8.0.50727.762.

For Visual C++ 2005 SP1 Redistributable (x86), please download it from:http://www.microsoft.com/download/en/details.aspx?id=5638

For Visual C++ 2005 SP1 Redistributable (x64), please download it from:http://www.microsoft.com/download/en/details.aspx?id=18471

 

If the update does not solve the problem, please install Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update:http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=26347


   最后一句话帮了忙。 安装了 Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update。该更新好像是删除了旧的Visual C++ 2005  Redistributable Package 使新安装的SP1能起作用。 我所用的dll依赖的VC80.CRT 和VC80.MFC的版本号是

VS2005 8.0.50727.6195。通过利用文本编辑器打开dll,搜索manifest关键字可查看dll依赖的其他dll的版本号(version number)。 另外还可以利用dependency walker (下载地址http://www.dependencywalker.com/)查看dll的依赖关系。

        在C:\Windows\WinSXS 中存放了很多为了保持程序的兼容性而存在的旧的dll和manifest文件,有很多文件的文件名相同但是版本号不同,一般最好不要移动和删除里面的文件(这个文件在Windows vista 和Windows 7里面特别大),否则某些程序的执行很容易出现崩溃,Windows的更新也可能产生问题。我试过把里面的文件剪切出来,再复制回去,就出现了程序不能执行的问题。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值