如何让两个安装程序setup共享同一个component—— installing shared files(version:installshield develop8.0)...
如何讓兩個安裝程序(setup.exe),共享同一個component?
要實現的效果是,兩個程序共享同一個dll,當兩個程序中有一個被卸載掉時,這個dll仍存在,不隨著第一個卸載而從系統中刪除,因為另一個程序還要用它嘛。而當兩個程序都被卸載時,這個dll被卸載掉。
原諒我幾乎用了8個多小時才搞明白...痛苦地搜索和閱讀過程就不贅述了,總之在幫助里找到一條靠譜的信息,幫助里的索引是Refcounting Shared Files內容如下
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.
文中我需要的內容就是:“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!!多么靠譜的功能啊!!!
這個機制就是:如果是shared files,在安裝它之后,windows installer就會在注冊表的一個鍵值里為它記數,不管被哪個安裝程序安裝,裝一次加1,裝一次加1(incremented)。同理,卸載一次減去1,卸載一次減去1。直到減少到0,此時,這個shared files就會被從系統中刪除了。
所以,實現的過程,有幾個問題需要解決:
如何讓一個file成為 shared file?
這個file是該component的 key file (Set Key File)
component的GUID是分辨component的唯一標志,也就是說GUID號相同的component,即使是不同的SETUP中也認為是同一個component。就是這條我想通了之后問題才解決的……
究竟注冊表里改了哪個數呢?好奇!
用我的猥瑣小工具終于找到了,提供給大家:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls\
---------------修改如下------------------------------------------
1、把兩個SETUP工程中需要共享的文件的component Code改為同一個。
2、把該文件設為KEY FILE
3、把注冊表中因為調試而導致HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls\)的該文件的記數不對的那條信息刪除
---------------搞定!嘎嘎嘎---------------------------------------
轉載于:https://www.cnblogs.com/boldness/archive/2013/01/22/2871274.html
總結
以上是生活随笔為你收集整理的如何让两个安装程序setup共享同一个component—— installing shared files(version:installshield develop8.0)...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Qt学习资料
- 下一篇: POJ 1850 Code(组合数学)