How do you register a Win32 COM DLL file in WiX 3?

The easiest way (and Rob M will rant and rave about how this is wrong) is just to use SelfRegCost=1 on the File tag for the DLL.

This is wrong, because we should be explicitly controlling the registration of the DLL, not allowing it just to run arbitrary code via DllRegisterServer. The theory being that a DLL should do nothing beyond putting the appropriate entries in the registry when DllRegisterServer is called. Unfortunately, a lot of of them do more than that, so self-registration might be the only way to get your install to work.

It’s also wrong, because that means the Windows installation system doesn’t know anything about those registry keys, and what should and shouldn’t be there. That means repairing won’t work, and possibly un-installation won’t clean up properly, etc.

Otherwise, you can generate the appropriate WiX code by pointing heat.exe at your DLL, and integrating its output into your current WiX project. You’ll get a variety of Class, ProgID, TypeLib, and Registry tags. You may need to manually edit that output to get it to compile.

I hope that helps.

Leave a Comment