File missing after upgrade

99封情书 提交于 2019-12-11 11:16:42

问题


I have installation of version 1.1. I created upgrade with version 1.2. In both products I have 2 files:

    <Component Win64="yes" Id="cmpFILE1" Guid="*">
  <File Id="filFILE1" KeyPath="yes" Source="$(var.BasePathCMP)\Performance.dll" />
</Component>
<Component Win64="yes" Id="cmpFILE2" Guid="*">
  <File Id="filFILE2" KeyPath="yes" Source="$(var.BasePathCMP)\LockLib.dll" />
</Component>

During the upgrade LockLib.dll is removed and not being replaced. In clean installation of 1.2 it is present. What can cause that behavior?


回答1:


One of the reasons why this happens is because the action RemoveExistingProducts is being executed after the installation package performed the upgrade. In this case, the MSI detects the file is the same as in previous version and then removes it. You could:

  1. Change order of RemoveExistingProducts
  2. Set the DLL to Shared

I'd recommend option one.

RemoveExistingProducts Element




回答2:


I'm thinking you changed the component guid for a file that is in both MSIs, older and upgrade. When the RemoveExistingProducts is towards the end of the install the upgrade behaves like a merge, overwriting files if necessary and incrementing ref counts for shared component guids. At the end the REP is removing the old product and decrementing ref counts for the component guids. If there are no more clients for the guid it will be removed. If the guid of a "shared" file changed it will have no more clients and be removed. The thing about an REP at the end is that you must follow component sharing rules, but you don't if you sequence REP at the start of the upgrade.

I'm adding an example for future reference.

Say the first install has 3 files A, B, C, and three guids that are 1, 2 and 3. Your upgrade has the same three files but the guids are 1, 2 and 8. When REP is at the end the upgrade installs over the old product first. Guids 1 and 2 get their ref counts incremented from 1 to 2. Guid 3 stays at 1. Then the older product is uninstalled. Guids 1 and 2 get ref counted down to 1, they are still in use so the files attached to the component guids stay. Guid 3 goes down to zero, has no ref counts so the component is removed, but it's attached to file C so C gets removed even though you just installed it.



来源:https://stackoverflow.com/questions/23760094/file-missing-after-upgrade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!