0

I have two installers:

  1. Installer A installs A.dll v1.0.0.0
  2. Installer B updates A.dll to v2.0.0.0

When I uninstall B, it does not delete A.dll. There is still A.dll with version 2.0.0.0

A.dll (v2.0.0.0) can be removed only from installer A.

Installers have different UpgradeCode and Component Ids.

How can I remove the replaced content of a Product from installer B?

Alex
  • 842
  • 11
  • 33

1 Answers1

2

Files that are shared between two setups (file is installed to the same absolute path by both setups) must maintain a single, stable component GUID to allow Windows Installer reference counting to work correctly. The mechanism to achieve this in Windows Installer is a merge module. WiX features its own way to handle shared files with the WiX include file approach.


I wrote an answer a while back with more information on merge modules and WiX include files here: WiX 3.8: Two MSI using the same registry values. How to delete registry values only if both MSI are uninstalled?


If you need to use different versions of the dll with different applications, then they should be installed to a private location for each application and they should have different component GUIDs:

ProgramFilesFolder\MyCompanyFolder\MyApp1\MyExe.exe version 1.0.0
ProgramFilesFolder\MyCompanyFolder\MyApp1\MyDll.dll version 1.0.0

ProgramFilesFolder\MyCompanyFolder\MyApp1\MyExe.exe version 2.0.0
ProgramFilesFolder\MyCompanyFolder\MyApp2\MyDll.dll version 2.0.0

Alternatively you can install them to a shared location in separate folders and bind properly via your manifest:

CommonFilesFolder\MyCompanySharedFiles\1.0\MyExe.exe version 1.0.0
ProgramFilesFolder\MyCompanyFolder\MyApp1\MyDll.dll version 1.0.0

CommonFilesFolder\MyCompanySharedFiles\2.0\MyExe.exe version 2.0.0
ProgramFilesFolder\MyCompanyFolder\MyApp2\MyDll.dll version 2.0.0

CommonFilesFolder\MyCompanySharedFiles\2.5\MyExe.exe version 2.5.8
ProgramFilesFolder\MyCompanyFolder\MyApp2\MyDll.dll version 2.0.0

You can deploy the shared files with a separate MSI so they can be updated without recompiling your main MSI, or you can use a merge module to compile the shared files into your main MSI (sort of static linking).

Finally you can install the shared files to the GAC if they are .NET assemblies (but don't):

Or you can install native Win32 files to the WinSxS side-by-side folder. For native files you can also install shared in System32 or SysWOW64 or another non-side-by-side, but shared folder.


A similar answer here: Wix Toolset: How to restore replaced file on uninstall. Much more elaborate than the above description.

And here is a rather comprehensive (and verbose unfortunately) description of how Windows Installer component referencing really works: How exactly are files removed during MSI uninstall?


And finally an answer with some recommendations on how to improve and simplify WiX files by using default attributes and enabling automatic component GUID generation. Highly recommended for you to check out: Continue the Wix setup after having a service that could not start. Don't let the title confuse you, it is generic WiX advice. I particularly recommend looking at the automatic component GUID feature since it will help you do component GUID assignment correctly.

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