Registration of .NET COM Assemblies with WiX

Even though it is recommended to use heat.exe in Pre-Build event to extract COM information from .NET assemblies, this method does not work if the COM component to be registered is an ActiveX control.

The only acceptably working solution I have found so far is use custom actions, for example:

<InstallExecuteSequence>
  <Custom Action='comReg' After='InstallFinalize'>NOT REMOVE</Custom>
  <Custom Action='comUnreg' Before='RemoveFiles'>Installed</Custom> 
</InstallExecuteSequence>

<CustomAction
  Id='comReg'
  Directory='INSTALLDIR'
  ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\regasm.exe" "[INSTALLDIR]my.dll" /codebase /tlb'
  Return='check' />

<CustomAction
  Id='comUnreg'
  Directory='INSTALLDIR'
  ExeCommand='"[WindowsFolder]Microsoft.NET\Framework\v2.0.50727\regasm.exe" /u "[INSTALLDIR]my.dll"'
  Return='check' />

Of course, there are some drawbacks, but in general, the solution works.

Link: Stackoverflow.