Go Back   PackageDeploy Application Packaging Forums > Package Development > Application Packaging > Platformsdk MSI

Reply
 
LinkBack Thread Tools Display Modes
Old 09-07-2010, 09:01 AM   #1 (permalink)
ylivny
Guest
 
Posts: n/a
Default Shared components with different versions

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
  Reply With Quote
Old 09-10-2010, 11:01 PM   #2 (permalink)
John
Guest
 
Posts: n/a
Default RE: Shared components with different versions

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
> .
>

  Reply With Quote
Old 09-11-2010, 11:01 AM   #3 (permalink)
Kalle Olavi Niemitalo
Guest
 
Posts: n/a
Default Re: Shared components with different versions

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.
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:14 AM.


vBulletin, Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
2007 - 2012 PackageDeploy.com