Remove file during minor upgrade

試著忘記壹切 提交于 2019-11-29 15:47:05

The book answer is use a major upgrade.

The ultimate MSI hacker's answer is to edit the previous MSI in ORCA to get the exact primary key and GUID values. Author that component statically into your latest ISM and then implement the "puncture component" pattern. This means you set the Revaluate attribute and then give it a condition that always evaluates to false. In this way the new MSI still has the component but it gets removed from the machine.

Stein Åsmul

Chris has described the method I normally use to fix such a problem. However, I find that a quicker approach is to rename the parent folder for the dynamically linked files. Just changing from MyFolder to My Folder will work - or any other name for that matter. The reason is that you de-couple the old files from the new ones. You no longer point to the same absolute paths, and MSI reference counting hence removes all old files correctly. And you need a major upgrade for this to work correctly like Chris says.

A very good summary of what is required for a minor upgrade to work (as well as other details): http://www.installsite.org/pages/en/msi/updates.htm

From the above site: "If you remove a file or registry key from a component, you must populate the RemoveFile or RemoveRegistry table respectively to delete the orphaned resource.". This might also work, but I would not use this approach.

Personally I would avoid dynamic file linking altogether. I have never been able to use dynamically linked files without it resulting in a problem. Generally they have been update and patching problems, but also other kinds. It really is not a good feature to use. Rather you should take the opportunity with the folder name change to add all files statically.

You can find more details on MSI component reference counting here: https://stackoverflow.com/a/1422121/129130

So in summary here is what I would do:

  • Create backup of your installation project
  • Delete all dynamically linked files
  • Modify the name of the parent directory that used to hosts dynamically linked files. For example from MyFiles to My Files will do.
  • Re-add all dynamically linked files with static components
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!