zoukankan      html  css  js  c++  java
  • [一个小问题]Mainfest配置文件的version问题小结

      问题起源自己安装好产品的新build,然后用自己本地编译出来的其中一个DLL去替换到产品中,本来以为可以正常执行,但是却发现这个新DLL无法被Load,无法被使用。

      从Event Viewer里找到了问题描述:

      ----------------------------------------------------------------------------------------------------

      Activation context generation failed for "C:Program FilesTrend MicroMessaging Security AgentinstDeferredCustomAction.dll".Error in manifest or policy file "C:Program FilesTrend MicroMessaging Security AgentMicrosoft.VC80.MFC.MANIFEST" on line 4. Component identity found in manifest does not match the identity of the component requested.

      Reference is Microsoft.VC80.MFC,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".

      Definition is Microsoft.VC80.MFC,processorArchitecture="amd64",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.762".

      Please use sxstrace.exe for detailed diagnosis.

      ----------------------------------------------------------------------------------------------------

      解决方法:

        只需到产品安装目录下找到Microsoft.VC80.MFC.MANIFEST文件,然后修改其version从762变为4053即可

      问题原因:

        我们的产品由visual studio 2005开发,依赖于Microsoft Visual C++ 2005(用户的电脑需安装vcredist_x86.exe,vcredist_x64.exe),我在本地开发时VC的版本是4053(原因是我安装了Visual C++ 2005 SP1 KB971090的安全更新,VC生成的manifest中引用的ATL/MFC/CRT库的版本从8.0.50727.762变成了8.0.50727.4053),而出build的机器其编译时依赖的VC版本是762(http://www.microsoft.com/zh-cn/download/details.aspx?id=5638),所以导致运行时出现此问题。

      知识扩展:

      1. Event Viewer对此定性为error,描述为SideBySide错误,什么是SideBySide?

        从Visual Studio 2005开始,微软创造了SideBySide DLL,创造这种DLL的初衷是许多程序可能会使用不同version的DLL,如果同一个DLL被替换为新version的DLL,可能会导致程序Crash(称之为DLL Hell),SideBySide DLL正为解决这一问题,也就有了Mainfest文件(与可执行程序或DLL相关)来指明哪个version的DLL可以被执行。Mainfest是个XML的描述文件,对于每个DLL有DLL的Manifest文件,对于每个应用程序Application也有自己的Manifest。

      

      目前对于这个问题的理解至此,希望今后遇到问题都能及时查找原因。不断进步:)

      参考:

      1. Working with Visual Studios C++ manifest files

        http://stackoverflow.com/questions/588712/working-with-visual-studios-c-manifest-files

      2. manifest的作用

        http://www.cppblog.com/kyelin/archive/2010/10/09/129163.html

      3. 终结VC2005分发包版本问题

        http://www.cnblogs.com/mixiyou/archive/2010/02/09/1663620.html

      Best Regards

  • 相关阅读:
    性能测试系列七 工具选择
    Selenium Web自动化面试题总结(下篇)
    性能测试系列六 评估压测量
    hexo 安装
    光纤收发器组网方式
    频谱仪
    交换机网管telent
    区块链共识机制
    SDH、MSTP、OTN和PTN
    ACL知识
  • 原文地址:https://www.cnblogs.com/KevinSong/p/3369077.html
Copyright © 2011-2022 走看看