views:

508

answers:

2

Following the advice of wcoenen, I've decided to try using registration-free COM. This works perfectly, excepting on pre-XP machines, of course. One idea which I thought would be kind of neat would be to add to some files, SelfRegCost='[var]'. It is quite likely that this is not The Right Thing™ but I still want to know how to do it, if only to satisfy my own curiosity. I'm assuming, perhaps incorrectly, that SelfRegCost='[var]' will not cause self-registration if var is an empty string. But this could be wrong.

This is similar to "WIX: How can the registry key be changed based on the OS on which the installer is running ?", but in my case I realize I can (and probably should) use a different component and just don't care.

It is quite likely I'll probably end up using a different component anyhow, but please satisfy my curiousity.

+2  A: 

I haven't had to do COM installation with WiX (thank god). But from the docs and this thread, it sounds like SelfRegCost is just there to give MSI an idea how much space it needs to verify is available. I'm guessing blank will either be an error, or be treated as a zero and still install the DLL.

I would definately go with the multiple components.

Rob McCready
Of course I should go with multiple components. But I'm curious how to do it with only one component, regardless of the awfulness of doing so.
Brian
Off hand, I'm guessing you can't. Components are the unit of conditional installation, so I don't believe you can install a single component but not all pieces of it, nor do I believe you would want to.
Rob McCready
Also possibly related, comment from Rob Mensching about SelfReg: http://stackoverflow.com/questions/364187/how-do-you-register-a-win32-com-dll-in-wix3
Rob McCready
+2  A: 

You need to use conditional components to install in different ways to different OS's.

What you are suggesting is to have part of the installation fail, but hopefully silently.

Using a custom action, you can do just that!

<CustomAction Id="YourId" Directory="INSTALLDIR" ExeCommand='regsvr32.exe /s "[INSTALLDIR]YourCOM.dll"' Return="ignore" />

This is of course not recommended for the slew of reasons Rob Mensching provides.

Rob Hunter
I don't like this answer, but using a custom action to register while still installing all the files in one component is closer to the intention (of my idea for a bad way to do this) than anything else.
Brian
I don't like it either (I agree with Rob McCready to use multiple components, and use registry entries for your COM in pre-XP), but it was the closest to your intention that I could think of.
Rob Hunter
That just looks like an evil genius idea. Upvote. ;)
Rob McCready

related questions