Registering SharpShell extension using SRM via WIX installer

127 views Asked by At

Firstly I should clarify that I am a novice and have been struggling to understand the WIX formatting, but by cobbling together examples found on-line, I now have the files installing fine so I next need to register my DLL.

I used the example here as a starting point: How to deploy a SharpShell-based shell extension via WiX? but it seems that the SharpShell tool srm.exe may not be getting called at installation.

If I manually call srm.exe as follows, it works as hoped i.e. the DLL is registered and my shell extension works.

srm install MyExtension.dll -codebase

I can also see that the registration has been successful via the Server Manager application that comes with SharpShell.

I can also manually uninstall with the following - not that this is particularly relevant to my problem but it at least confirms that the manual methods work:

srm uninstall MyExtension.dll

Here is a fragment of my WXS file. When I run the resultant MSI, the files are installed but the DLL is not being registered; confirmed via SharpShell's Server Manager. Where am I going wrong?

        </Component>
        <Component Id="SRMexe" Guid="C17BB61F-6471-46F9-AA87-2D14D2456632">
            <File Id='srm' Name='srm.exe' DiskId='1'  Source='..\MyExtension\packages\SharpShellTools.2.2.0.0\lib\srm.exe' KeyPath='yes'>

            </File>
        </Component>
            <!-- TODO: Insert files, registry keys, and other resources here. -->
        <!-- </Component> -->
    </ComponentGroup>
</Fragment>
<Fragment>
    <CustomAction Id="InstallShell" FileKey="srm"
      ExeCommand='install "[INSTALLFOLDER]\MyExtension.dll" -codebase'
      Execute="deferred" Return="check" Impersonate="no" />
    <CustomAction Id="UninstallShell" FileKey="srm"
          ExeCommand='uninstall "[INSTALLFOLDER]\MyExtension.dll"'
          Execute="deferred" Return="check" Impersonate="no" />
    <InstallExecuteSequence>
        <Custom Action="InstallShell"
          After="InstallFiles">
            NOT Installed
        </Custom>
        <Custom Action="UninstallShell"
          Before="RemoveFiles">
            (NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
        </Custom>
    </InstallExecuteSequence>
</Fragment>
1

There are 1 answers

1
Rob Mensching On

It doesn't look like you have any references to the Fragment with the CustomAction definitions so they are not linked into your final output MSI.

Add a CustomActionRef from your Product element to create the reference.