首页 > 编程知识 正文

manifest 文件清单 注册(manifest文件添加第三方包)

时间:2023-05-05 09:53:53 阅读:75575 作者:1604

Manifest是XML描述文件,每个DLL都有DLL的Manifest文件,每个APP应用程序应用程序都有自己的Manifest。 对于APP应用程序,Manifest作为资源嵌入在与exe文件位于同一目录中的. Manifest文件或exe文件内部(嵌入式管理)。

XP之前版本的windows像以前一样运行此exe文件,然后查找相应的dll。 如果每个文件都没有Manifest,则它只是额外的文件或资源,dll文件将直接在system32目录中搜索和调用。 因此,当公共DLL升级后,以前安装的APP应用程序将不再可用。 这就是“DLL Hell”的来源。 为了解决这个问题, NET开发为了避免这个问题提出了side-by-by的开发方法。 主要方法是从Manifest文件中查找相应的DLL。 XP和更高版本的系统集成了这种DLL搜索方法。

编辑提取Manifest的缺省Manifest文件(如果需要)嵌入在exe/dll中。 VS提供了用于从exe/dll提取管理文件的mt.exe工具。

关于在mt.exe-input resource : d :test.exe-out : d :test.manifest中编辑的manifest文件设置编译MFC项目

# ifdef _ unicode # if defined _ m _ ix86 # pragma comment (链接器,' /管理从属关系: ) (' type=' win32 ' name=' Microsoft.windows.com mon-controls ' version='6.0.0.0'处理器体系结构=' ) '/manifest dependency :3 ' type=' win32 ' name=' Microsoft.windows.com mon-controls ' version='6.0.0' 程序注释(链接器, '/manifest dependency :3 ' type=' win32 ' name=' Microsoft.windows.com mon-controls ' version='6.0.0' 程序注释(链接器, '/manifest dependency :3 ' type=' win32 ' name=' Microsoft.windows.com mon-controls ' version='6.0.0' 对于endif非unicode版本,生成的接口为Win98样式;对于unicdoe版本,生成的接口为当前操作系统的样式。 linker-manifest file-generate manifest-yes将为EXE/DLL生成manifest文件。

? XML版本=' 1.0 '编码=' utf-8 '标准版='是'? assembly xmlns=' urn :方案- Microsoft-com : ASM.v1 ' manifest version=' 1.0 '

' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> </dependentAssembly> </dependency> <dependency> <dependentAssembly> <assemblyIdentity type='win32' name='Microsoft.VC80.MFC' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> </dependentAssembly> </dependency> <dependency> <dependentAssembly> <assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*' /> </dependentAssembly> </dependency></assembly>

如果没有设置上面的控件风格,则生成的Manifest不会包括contrls.

<?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.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> </dependentAssembly> </dependency> <dependency> <dependentAssembly> <assemblyIdentity type='win32' name='Microsoft.VC80.MFC' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> </dependentAssembly> </dependency></assembly>

所有的exe/dllFT都必须要有Manifest。如果Linker→Manifest file→Generate Manifest→No,则在必须Manifest Tool→Additinal Manifest Files中指定相应的Manifest文件。 Manifest Tool→Embed Manifest→Yes。一般都是将Manifest文件嵌套在程序中。也可以不嵌套在程序中,像MFCxx.dll, MSVCRxx.Dll,MSVCPxx.dll都是没有将Manifest嵌套在程序中的。所以当使用它们时必须与其Manifest文件一起使用。

编辑 EXE调用DLL的过程

以下针对链接MFCxx.dll, MSVCPXX.DLL, MSVCRxx.dll的程序。 
系统启动exe时,会先检查其Manifest文件(如果没有查找到当前EXE中有Manifest,则会报“程序配置不正确的”的错误提示),查找系统中是否有注册相应的Dll组件。如果有,则会去c:windowswinsxsManifest文件夹根据相应的调用策略及Manifest文件,然后再根据Manifest中的内容去c:windowswinsxs同名文件夹中查找到关的DLL。 
如果没有查找到相应的DLL,则会到当前目录来查找Microsoft.VC80.CRT.manifest和Microsoft.VC80.MFC.manifest。 
如果没有查找到当前EXE中有Manifest,则会报“程序配置不正确的”的错误提示。查到之后,就会去找相应的DLL。然后执行程序。

编辑 相关DLL介绍

选择Use MFC in share DLL会用到MFCxx.DLL. MFC80.dll, 即对应VS2005的。 MFC80U.DLL,即对应VS2005的Unicode版本。

选择MD/MDd则会用到下面的DLL。 MSVCR80.dll,即VS2005下的C RunTime库,提供基本的C函数。 MSVCP80.dll, 即VS2005年的C++函数库,如果有调用<string>之类的文件,则会使用到此DLL。

编辑 注意

1、X86、X64需要去VS工具目录

C:Program Files (x86)Microsoft Visual Studio 10.0VCredistx86C:Program Files (x86)Microsoft Visual Studio 10.0VCredistx64

2、Manifest文件自VS2010之后,又被集成到模块当中去了,不再分开提供。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。