Problem with file sharing - Advanced Installer Community
McKool
Posts: 113
Joined: Wed Jan 19, 2011 12:35 pm
Location: Darmstadt, Germany
Contact: Website

Problem with file sharing

A.I: 13.1
OS: Windows 10 - 64 Bit

Hello support,

I'm experimenting some problems when trying to install a file that is shared. I have tried with the SharedDLL count (Organization -> Component Properties) and also using the same GUID for the shared file. Unfortunately, both approaches end with an undesired behavior.

Installation description:
  • There are several Merge-Modules that use the same file
  • A main Setup have several features, one feature for each merge-module
  • The features can be selected to be installed --> the shared file can be installed several times from the same Setup, over different merge modules
  • The main Setup can be modified --> Features can be added and/or removed after installation
Approach 1: The file is marked as SharedDLL wherever it appears --> in each merge module.
Test: The main Setup is configured to install two features (shared file is installed two times)
Results:
  • After installation, the file is added to the list of shared DLLs (HKLM\Software\Microsoft\Windows\CurrentVersion\SharedDLLs) --> OK
  • After installation, the SharedDLL counter is set to 2 --> OK
  • Adding and/or removing features successfully update the counter --> OK
  • After uninstall, the DLL is no longer in the list of SharedDLLs (HKLM\Software\Microsoft\Windows\CurrentVersion\SharedDLLs) --> OK
  • The shared file is left installed --> NOT OK

Approach 2:
The file is NOT marked as SharedDLL in any place, but it uses the same GUID wherever it appears --> in each merge module.
Test: The main Setup is configured to install two features (file with same GUID is installed two times)
Results:
  • The Installation succeeds, no entry to the list of shared DLLs is made --> OK
  • Removing one feature is enought to get the "shared" file uninstalled --> NOT OK
  • Doing an uninstall DOESN'T remove the other feature, i.e. files are left installed --> NOT OK
  • Note that, if I use the merge modules in different Msi, then it works.
Notes:
- Regarding approach 1: It seems as the SharedDLL mechanism is working well, up to the point where the file has to be removed. Could be that inside of AI the counter for the file stays as 1 instead of 0, or something like that?
- regarding approach 2: It seems as the problem can be tied to the fact, that the shared file is inside of merge modules. It is possible that the GUID of a merge module is being combined with that from the file and for that reason is not being taken as a shared file but as two different files?
- Here is an image that shows the setup configuration for better understanding:
Setup project configuraiton
Setup project configuraiton
SharedFile.jpg (132.31 KiB) Viewed 3810 times
Thanks in advance for your help.

Best regards,
Keneth
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem with file sharing

Hello Keneth,

You should be able to achieve what you want by using different GUIDs for each of your MSM components of the shared file and also check the "Shared Dll Reference Count" flag for each component. I've tested this scenario and the file was also removed after the product removal or after the removal of all features that include the shared file. Can you please test again this scenario on a new machine? For testing purposes we always recommend to be used virtual machines with clean states so that when something goes wrong you can easily revert to a clean state of the virtual machine.

Also, as a side note, please note that Windows Installer is not designed to share a component (use the same GUID) between more merge modules. A merge module is a set of components which could be shared between multiple setup package. However you cannot share a component between multiple merge modules. For such a component you should create a different merge module.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
McKool
Posts: 113
Joined: Wed Jan 19, 2011 12:35 pm
Location: Darmstadt, Germany
Contact: Website

Re: Problem with file sharing

Hello Daniel,
Daniel wrote:You should be able to achieve what you want by using different GUIDs for each of your MSM components of the shared file and also check the "Shared Dll Reference Count" flag for each component.
This is what I have explained in the first approach. When using the SharedDLL count the merge modules do have different GUIDS. As I've described, the very last uninstall fail to remove the file in question.
Daniel wrote:For testing purposes we always recommend to be used virtual machines with clean states so that when something goes wrong you can easily revert to a clean state of the virtual machine.
We go a step forward. We have a real "clean" machine (that we also can easily revert), since we need to test in a real scenario.
Daniel wrote:Also, as a side note, please note that Windows Installer is not designed to share a component (use the same GUID) between more merge modules.
Ok, I didn't know this officially, but I was quite sure that share components with same GUID within merge modules could be something unsupported. I remember that merge modules attach their GUIDs to their components, so using the same GUID for a component will actually don't help.

At the end we have decided to avoid sharing the file by changing the folder structure. Nevertheless, I will do some other tests and, if I still see the wrong behavior, I will try to isolate it in simple projects.

Thanks and best regards,
Keneth
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem with file sharing

You're always welcome Keneth.

Just let us know if we can further assist you.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”