Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

registering com dll in wix

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?

like image 625
rakheep Avatar asked May 09 '12 06:05

rakheep


People also ask

How do I register a DLL file?

Click Start > All Programs > Accessories and right-click on "Command Prompt" and select "Run as Administrator" OR in the Search box, type CMD and when cmd.exe appears in your results, right-click on cmd.exe and select "Run as administrator" At the command prompt, enter: REGSVR32 "PATH TO THE DLL FILE"

Do all DLL files need to be registered?

Short answer is that you don't need to register DLLs in order to use them. The only exception to this is COM and ActiveX DLLs which need to add certain keys to the registry. For a normal DLL (including . NET class libraries), all you need to know is the path to the DLL.

What does it mean to register DLL?

By registering a DLL, you are adding information to a central directory (the Registry) for use by Windows. The information typically includes a "friendly name" for the component, which makes it easier to use from within another program, and the full path to the . dll or .

What is WiX C#?

InfoQ: For the benefit of our readers who haven't heard of it before, what is WiX#? Oleg: Wix# (WixSharp) is a deployment authoring framework targeting Windows Installer (MSI). Wix# allows building complete MSI setups from a deployment specification expressed with C# syntax.


1 Answers

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>
like image 188
A.Game Avatar answered Oct 12 '22 17:10

A.Game