|
|
#1 (permalink) |
|
Guest
Posts: n/a
|
Hello all,
I have the following scenario: * Product A installs a component that contains foo.dll (version 1.0.0.0) to folder Bar * Product B installs a component that contains foo.dll (version 2.0.0.0) to the same folder. * Both components have the same GUID + First I install Product A ==> foo.dll (version 1.0.0.0) is installed to folder Bar + Now I install Product B ==> foo.dll (version 2.0.0.0) replaces version 1.0.0.0 in folder Bar + Now I uninstall Product B ==> foo.dll (version 2.0.0.0) remains in folder Bar (even if I repair the installation of Product A it will still remain version 2.0.0.0) Is there a way to tell MSI to restore foo.dll back to version 1.0.0.0 in this case? Thanks in advance, Yonathan |
|
|
|
#2 (permalink) |
|
Guest
Posts: n/a
|
Hi Yonathan,
Since the components have the same name and GUID, they represent the same component for Windows Installer. This means that Windows Installer will use a reference count for it: - after installing A the reference count is 1 and version 1.0.0.0 is installed - after installing B the reference count is 2; since version 2.0.0.0 is higher than 1.0.0.0, the original file is overwritten by the updated version - when uninstalling A or B, the reference count becomes 1; since the count is not 0, the component is ignored so the file is left on disk If you want to restore the original version when uninstalling B, the only solution is to use custom actions in the product B installer: - during install use a custom action to backup version 1.0.0.0 (copy the file in a backup folder); it should run at the beginning, before overwriting the original file - during uninstall use another custom action to restore version 1.0.0.0 (copy the file from the backup folder to installation folder) Regards, John -- http://www.setupanddeployment.com/ "ylivny" wrote: > Hello all, > > I have the following scenario: > > * Product A installs a component that contains foo.dll (version > 1.0.0.0) to folder Bar > * Product B installs a component that contains foo.dll (version > 2.0.0.0) to the same folder. > * Both components have the same GUID > > + First I install Product A ==> foo.dll (version 1.0.0.0) is installed > to folder Bar > + Now I install Product B ==> foo.dll (version 2.0.0.0) replaces > version 1.0.0.0 in folder Bar > + Now I uninstall Product B ==> foo.dll (version 2.0.0.0) remains in > folder Bar > (even if I repair the installation of Product A it will still > remain version 2.0.0.0) > > Is there a way to tell MSI to restore foo.dll back to version 1.0.0.0 > in this case? > > Thanks in advance, > Yonathan > . > |
|
|
|
#3 (permalink) |
|
Guest
Posts: n/a
|
John <John@discussions.microsoft.com> writes:
> If you want to restore the original version when uninstalling B, the only > solution is to use custom actions in the product B installer: > - during install use a custom action to backup version 1.0.0.0 (copy the > file in a backup folder); it should run at the beginning, before overwriting > the original file > - during uninstall use another custom action to restore version 1.0.0.0 > (copy the file from the backup folder to installation folder) But if another product C also contains version 2.0.0.0, and the user does this: - installs A (MSI installs 1.0.0.0) - installs B (custom action backs up 1.0.0.0; MSI installs 2.0.0.0) - installs C (MSI keeps 2.0.0.0) - uninstalls B (MSI keeps 2.0.0.0; custom action restores 1.0.0.0) then the wrong version will be left installed. And if product C is released after product B, B won't recognize it specifically. The products might cooperate via some file or registry key though, keeping track of which products include which versions and where the older versions have been backed up. I think restoring the older version of the component is mainly a requirement if the new version depends on some libraries that are included in the package that contains the new version but then get uninstalled with it. However, the custom action in product B cannot just check whether the libraries are being uninstalled, because MSI may keep them installed because of some unrelated product D that does not include the component at all and won't downgrade it when uninstalled. If you can make the old and new versions separate components so that they install side by side, that solves this stupidity of MSI. It is not always possible, though. |
|