[一个小问题]Mainfest配置文件的version问题小结

  问题起源本身安装好产品的新build,而后用本身本地编译出来的其中一个DLL去替换到产品中,原本觉得能够正常执行,可是却发现这个新DLL没法被Load,没法被使用。html

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

  ----------------------------------------------------------------------------------------------------redis

  Activation context generation failed for "C:\Program Files\Trend Micro\Messaging Security Agent\instDeferredCustomAction.dll".Error in manifest or policy file "C:\Program Files\Trend Micro\Messaging Security Agent\Microsoft.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".ide

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

  Please use sxstrace.exe for detailed diagnosis.ui

  ----------------------------------------------------------------------------------------------------spa

  解决方法:component

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

  问题缘由:

    咱们的产品由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

相关文章
相关标签/搜索