VS2008發布程序
下列附有VS2008發布程序介紹:
vc2008程序發布指南2008-05-03 17:46vc2008開發的程序的發布方式可以有5種方式:
1. 采用靜態鏈接到crt和MFC. 只要你擁有組成程序的所有源代碼,你就可以采用這種方式,
這種方式除了程序變大一點,好處多多:
1) 不必重新發布vc2008基礎庫vcredist_x86.exe(安裝到WinSxS).
2) 不必產生,嵌入manifest.
3) 也不把vc2008基礎庫放在程序所在目錄.
2. exe(嵌入manifest) + vcredist_x86.exe
確保程序正確產生并嵌入manifest文件,然后把程序和vcredist_x86.exe一起發布.用戶先安裝
vcredist_x86.exe(安裝到WinSxS),然后程序就能正常運行了.
3. exe(嵌入manifest) + 用到的基礎庫文件放到程序目錄(包括庫文件本身的manifest文件)
確保程序正確產生并嵌入manifest文件,然后把程序用到的vc2008基礎庫相關文件復制到程序
所在目錄,這種方式適用于用戶沒有安裝過vcredist_x86.exe,一旦用戶安裝過vcredist_x86.exe,
若WinSxS中的相關文件遭到破壞,那么即使在程序目錄放上所有用到的vc2008基礎庫,程序也跑
不起來;若WinSxS中的相關文件正常,那么程序目錄下的相關文件就是多余的了,刪掉它們程序也能
正常運行.
4. exe(自行編寫manifest) + vcredist_x86.exe
5. exe(自行編寫manifest) + 用到的基礎庫文件放到程序目錄(包括庫文件本身的manifest文件)
另外,C:/Program Files/Common Files/Merge Modules 目錄下有相應庫的集成模塊可以直接集成到安裝包中去.
附錄:
A. 自行編寫的manifest文件命名: abc.exe 對應abc.exe.manifest
B. 與程序對應的manifest的格式:
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
<dependency> // VC9 的CRT, 基本上所有用vc2008的程序都需要下面一段
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
//用到 VC9的MFC庫,需要加下面一段
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC90.MFC' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
<dependency> //想使用windows xp 的6.0版本的通用控件,加需要下面一段
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*' />
</dependentAssembly>
</dependency>
</assembly>
C. 如何確保程序正確產生并嵌入manifest文件?
- xxxproject > properties > Configuration Properties > Generate Manifest: 確保為Yes
這個與Configuration Properties >Linker > Manifest File >Generate Manifest都是指同一個設置.
- Project > Tool Build Order > Manifest Tool確保打勾.
release版本可以看到有: xxx.exe.intermediate.manifest 生成, 它是由linker生成的,由manifest tool嵌入程序的.
debug版本manifest tool把xxx.exe.intermediate.manifest嵌入程序后還會輸出一個xxx.exe.embed.manifest,供檢查內容是否一樣