0

I use heat util from the WIX toolset to generate COM registration of a dll. All works fine until there is only one product using that dll.

But when this dll was already registered by another product or is used by later-installed products, uninstalling of my product removes DLL registration and breaks other applications.

Is there a way to overcome this issue? I have an idea to make generated component permanent, but looks like there is no simple way to accomplish it. And it is not ideal situation because it would be better to remove DLL registration if our application is the opny one who use that dll.

The other issue is registering dll changes the previous registration even if it has newer version. Again it will break other applications. We would like to use never version if it is already installed.

Can anybody recommend a simple solution to overcome described issues?

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
Sasha
  • 8,537
  • 4
  • 49
  • 76

1 Answers1

1

When adding a shared DLL you should encapsulate the DLL in a component with the same ID in both products. The component will be installed when it is not already installed. It will be removed when the last product that uses it is uninstalled. Use a WiX library to handle the shared component.

You will have to find a install location for that shared DLL. When you uninstall product A you will expect that the install folder of the product is removed and the same appears for product B. Therefore the shared DLL should be in the Common Files tree.

Since the COM registration has always an absolute path to the COM server DLL, it is always bound to the DLL in the appropriate product. If the product installers don't share the knowledge about the shared DLL your product should avoid sharing the DLL. You can use Registration Free COM to achieve this.

harper
  • 13,345
  • 8
  • 56
  • 105
  • But this component isn't used just in my installers. The "product A" is 3rd party. I'll try to get it's component ID, but have not a big hope it will work =(. – Sasha Jan 03 '13 at 17:04
  • The title of your question mentioned a `reusable COM registration component`. When you have a 3rd party installer they will not reuse your installer component. – harper Jan 03 '13 at 17:25
  • Yes, probably the title doesn't describe the problem in all details... Sorry. But actually I need to make my component reusable across my products, while some other products already use that dll and performs COM registration. They don't place the dll into shared folder and removes it when uninstalled. Ideally would be to separate my dll from "their". But as far as I know, it is impossible because of the shared COM objects. Otherwise I wouldn't have asked this question. Do you have any idea of workaround in this situation? – Sasha Jan 04 '13 at 09:32
  • About Registration Free COM - good point. But the products I'm creating installers for are already finished and remaking them to this approach isn't an option unfortunately =( – Sasha Jan 04 '13 at 10:34
  • 2
    The problem your are describing is the so-called DLL-hell. It's not an installer question. You have the same problem, when you try to xcopy the products to the target PC and register the COM servers with regsvr32. Removing the last registered COM server (same as uninstalling the last installed product) breaks the product that was running before. see: http://en.wikipedia.org/wiki/DLL_Hell When your product (why do you write in plural?) does not solve the problem with the DLL it is not finished. Sorry, you can't solve the problem with an installer. – harper Jan 04 '13 at 14:00
  • Many thanks. I would consider this an answer because now I have enough evidence not to include that dll at all as it was in few previous products. I use "products" in plural because we have few different products that use the same COM dll (3rd party and which is used by few other vendors). – Sasha Jan 06 '13 at 15:42