如何让两个安装程序setup共享同一个component—— installing shared files(version:installshield develop8.0)...
如何讓兩個(gè)安裝程序(setup.exe),共享同一個(gè)component?
要實(shí)現(xiàn)的效果是,兩個(gè)程序共享同一個(gè)dll,當(dāng)兩個(gè)程序中有一個(gè)被卸載掉時(shí),這個(gè)dll仍存在,不隨著第一個(gè)卸載而從系統(tǒng)中刪除,因?yàn)榱硪粋€(gè)程序還要用它嘛。而當(dāng)兩個(gè)程序都被卸載時(shí),這個(gè)dll被卸載掉。
原諒我?guī)缀跤昧?個(gè)多小時(shí)才搞明白...痛苦地搜索和閱讀過程就不贅述了,總之在幫助里找到一條靠譜的信息,幫助里的索引是Refcounting Shared Files內(nèi)容如下
Windows Installer has a built-in mechanism for installing shared files. If the component is installed and its Shared property is set to Yes, a reference count in the registry is created, if necessary, and incremented for the component's key file .The installer increments the reference count for any file in a component whether or not you mark the component as shared. However, if no reference count exists, the installer does not create one unless you specify that the component's key file is shared. To specify that your component's key file is a shared file:In the Setup Design view or Components view, select the component in the tree view.In the Components view, select the component in the tree view. Its property sheet opens to the right. Click on the Shared property to display a drop-down list below the property sheet. Select Yes from the drop-down list to set that component's key file as shared. The changes you make are reflected in the property sheet. Windows logo guidelines require you to increment a reference count when installing shared files and to decrement the count when uninstalling. Core component files (which they recommend you not install) should not be refcounted.
文中我需要的內(nèi)容就是:“Windows Installer has a built-in mechanism for installing shared files. ...a reference count in the registry is created, if necessary, and incremented for the component's key file”多么靠譜的Windows Installer!!多么靠譜的功能啊!!!
這個(gè)機(jī)制就是:如果是shared files,在安裝它之后,windows installer就會(huì)在注冊(cè)表的一個(gè)鍵值里為它記數(shù),不管被哪個(gè)安裝程序安裝,裝一次加1,裝一次加1(incremented)。同理,卸載一次減去1,卸載一次減去1。直到減少到0,此時(shí),這個(gè)shared files就會(huì)被從系統(tǒng)中刪除了。
所以,實(shí)現(xiàn)的過程,有幾個(gè)問題需要解決:
如何讓一個(gè)file成為 shared file?
這個(gè)file是該component的 key file (Set Key File)
component的GUID是分辨component的唯一標(biāo)志,也就是說GUID號(hào)相同的component,即使是不同的SETUP中也認(rèn)為是同一個(gè)component。就是這條我想通了之后問題才解決的……
究竟注冊(cè)表里改了哪個(gè)數(shù)呢?好奇!
用我的猥瑣小工具終于找到了,提供給大家:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls\
---------------修改如下------------------------------------------
1、把兩個(gè)SETUP工程中需要共享的文件的component Code改為同一個(gè)。
2、把該文件設(shè)為KEY FILE
3、把注冊(cè)表中因?yàn)檎{(diào)試而導(dǎo)致HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls\)的該文件的記數(shù)不對(duì)的那條信息刪除
---------------搞定!嘎嘎嘎---------------------------------------
轉(zhuǎn)載于:https://www.cnblogs.com/boldness/archive/2013/01/22/2871274.html
總結(jié)
以上是生活随笔為你收集整理的如何让两个安装程序setup共享同一个component—— installing shared files(version:installshield develop8.0)...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Qt学习资料
- 下一篇: POJ 1850 Code(组合数学)