cominstallationwixcom-server

Registering COM server with Wix


I have the following WiX code that registers a COM server component

<Component Id="ServerComponent" Guid="<someguid>">
    <File Id="comserverid" Name="comserver.exe" Source="path_to_com_server" DiskId="1" Checksum="yes" >
        <TypeLib Id="{<TYPELIBGUID>}" Description="ComServer 1.0 Type Library"  HelpDirectory="INSTALLLOCATION"  Language="0" MajorVersion="1" MinorVersion="0">
            <AppId Description="ComServer" Id="{<APPIDGUID>}}">
                <Class Id="{<SOMECLASSGUID>}" Context="LocalServer32" Description="ComServerClass Class" ThreadingModel="apartment" Advertise="no">
                    <ProgId Id="ComServer.ComServerClass.1" Description="ComServerClass Class">
                        <ProgId Id="ComServer.ComServerClass" Description="ComServerClass Class" />
                    </ProgId>
                </Class>
            </AppId>                                
        </TypeLib>
    </File>
    <RegistryValue Root="HKCR" Key="AppID\comserver.exe" Name="AppID" Value="{<APPIDGUID>}" Type="string" Action="write" />
</Component>

And it successfully registers the server, but when I the run program in "run as" mode, the program didn't see the COM server.

Please advice - how I should change the WIX code

Update: The answer is - run WiX script with elevated permissions or run comserver.exe /regserver with elevated permissions, but it doesn't work. I think that the script above is useful, so I leave question as is and create a slightly different question


Solution

  • Check the value of your ALLUSERS property. You should be defining it to 1 or 2 if you want a per-machine install. If it installs as per-user the registry updates will be written to HKCU instead of HKLM. ( HKCR can point to either HKCU\Software\Classes or HKLM\Software\Classes depending on the scope of the installation ).