1

I have two MSI projects, Setup1 and Setup2. Both MSI installers have one component (CompXYZ) which has dynamic file linking and shares the same files. But when I install Setup1 and Setup2 on same system, during uninstall of any of the product (Setup1 or Setup2) it removes the files associate with CompXYZ. I wanted to keep those files as it is during uninstall, if any of the Product, Setup1 or Setup2 is still installed on system.

I tried the Shared property of component as well as the Multiple Package Shared component property, but it didn't work. Because this component has dynamic file linking and the files are not versioned files.

Is there any other way to achieve this scenario?

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
Ajit Medhekar
  • 1,018
  • 1
  • 10
  • 39

1 Answers1

1

Component Referencing: Are these products live? Don't use dynamic linking if you can help it. You have component referencing issues, and it is caused by the dynamic linking: Change my component GUID in wix? Essentially: components (and their files) are reference counted by absolute paths (key paths). Hence, if two setups install the same file to the same absolute path, they should use the same component GUID. It is the same file being reference counted - its reference count should be 2 once both products are installed.

Once a component GUID is assigned to a key path, the hosting setup thinks it "owns" the path. If no other clients are registered using the component, it thinks it can uninstall the component on uninstall - its reference count is 1. See the more elaborate discussion in the link above.

Solution: It depends on whether you are live or not. If you are live I would change the installation path for both files and assign new component GUIDs to both components to "break the link to past sins". You can do this by installing to a different folder, or by just changing the file name a little (that also changes the absolute path). If you are not live yet, you can just set the components to use the same component GUID in both setups. Ideally you would put such components in a merge module.¨

There should be a feature to synchronize component GUIDs between different versions of the same setup. I think you add it in the release view. Patch optimization or something like that. I wouldn't trust it. Stop using dynamic linking is what I would suggest, and set a hard coded path. And use a single file per component. Solves all kinds of problems - especially for packages whose future is hard to predict.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164