Registering com dll in wix

comheatwixwix3wix3.5

If not self registering. then how do we perform the COM dll registering while installation using WIX?

As per the tutorial, I used ComPlusApplication example (non .net dll). But its not working. It fails to register.

I can register using regsvr32 from the command line successfully.
I read about not creating custom actions for registering com dlls.

SO what is the best approach?
If we need to use heat, where do we write the commands and add the result wxs to the main project?

Best Answer

I would strongly recommend using the Wix tool Heat.exe to harvest all the data needed to register the com component and then reference the fragment in your .wxs file like this:

    <ComponentGroupRef Id="FooBar.dll" />

Or include it in your .wxs file like this:

    <?include FooBar.dll.wxi?>

This method gives you full control over what happens during the registration/Unregistration of the Com component.

You can however still use Regsvr32 in a Wix project. But it relies on the correct implementation of the RegisterServer/UnregisterServer functions in the COM component

    <CustomAction Id="RegisterFooBar" 
                  Directory="INSTALLDIR" 
                  ExeCommand='regsvr32.exe /s "[INSTALLDIR]FooBar.dll"'> 
    </CustomAction> 
    <CustomAction Id="UnregisterFooBar" 
                  Directory="INSTALLDIR" 
                  ExeCommand='regsvr32.exe /s /u "[INSTALLDIR]FooBar.dll"'> 
    </CustomAction>

Then add your action to the install sequence.

    <InstallExecuteSequence> 
        <Custom Action="RegisterFooBar" After="InstallFinalize">NOT Installed</Custom>
        <Custom Action="UnregisterFooBar" After="InstallFinalize">REMOVE="ALL"</Custom>
    </InstallExecuteSequence>
Related Topic