日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

一分钟明确 VS manifest 原理

發布時間:2023/12/13 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 一分钟明确 VS manifest 原理 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

什么是vs 程序的manifest文件

manifest 是VS程序用來標明所依賴的side-by-side組建,如ATL, CRT等的清單。

為什么要有manifest文件

一臺pc上,用一組建往往會有不止一個版本號(c:/windows/winsxs或系統文件夾下),程序在載入的時候,不知載入哪個,于是manifest文件來指明。

manifest在哪兒,怎樣創建。

假設用VS開發,能夠Set通過porperty->configuration properties->linker->manifest file->Generate manifest To Yes來自己主動創建manifest來指定系統的和CRT的assembly版本號。

除了這樣產生外部的manifest file,還有embedded manifest信息能夠被寫到所生成的二進制文件內

Set porperty->configuration properties->manifest tool->embed manifest? To Yes

對于xp及早前的windows版本號,external manifest會比embed manifest有更高的優先級,但對于windows server及后的版本號,相反。

為什么我的manifest明明指明

name="Microsoft.VC80.DebugCRT" version="8.0.50608.0",

可是用depends.exe工具卻發現引用的是8.00.50727.42呢?

由于在C:/WINDOWS/WinSxS/Policies下,有publisher configuration file也叫policy文件,如8.0.50727.42.policy文件對依賴做了重定向:

<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" processorArchitecture="ia64" publicKeyToken="1fc8b3b9a1e18e3b"/>
<bindingRedirect oldVersion="8.0.41204.256-8.0.50608.0" newVersion="8.0.50727.42"/>
</dependentAssembly>

指明"8.0.41204.256-8.0.50608.0"都被定向到8.0.50727.42。這是assembly提供商如MS對低級版本號bug的修正而提供的解決方法。除此之外,你也能夠用application config文件來對本程序做assembly的重定向。如在你bin local目錄下 yourbin.extention.config:

<configuration>
?????? <windows>
?????????? <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
??? ????? <dependentAssembly>
??? ??? <assemblyIdentity type="win32" name="Microsoft.VC80.ATL" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
??? ??? <bindingRedirect oldVersion="8.0.41204.256-8.0.50608.0" newVersion="8.0.50727.42"/>
??? ????? </dependentAssembly>
??? ????? <dependentAssembly>
??? ??? <assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"/></assemblyIdentity>
??? ??? <bindingRedirect oldVersion="8.0.41204.256-8.0.50608.0" newVersion="8.0.50727.42"/>
??? ????? </dependentAssembly>
??? ?? </assemblyBinding>
?????? </windows>
</configuration>

怎樣決定我程序manifest信息所指定的assembly版本號信息?

在assembly頭文件里,assembly的版本號信息被指明了。如crtassem.h中

#ifndef _CRT_ASSEMBLY_VERSION
#define _CRT_ASSEMBLY_VERSION "8.0.50608.0"
#endif

能夠改動8.0.50608.0為8.0.50727.42以產生你想要的manifest信息。

若我想將我的程序公布為獨立程序集(isolated application),不去依賴目標pc的系統assembly,該怎么辦?

帶上全部依賴的assembly和對應的manifest文件(c:/windows/winsxs),注意,manifest信息要直接能夠指定到所附帶的assembly DLLs,不須要依賴policy的重定向。

轉載于:https://www.cnblogs.com/mengfanrong/p/3805788.html

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的一分钟明确 VS manifest 原理的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。