Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing and registering shell extension Context menu From wix installer

I created sharp shell extension for customizing right click menu context of windows using .Net. The result of the project is a .dll. I tries to install and register it using Server manager Tool which exists with the sharp shell tools and it worked successfully. Now I need to install and register this shell extension from my wix project, as I need the user to install my app and get his right click context menu of windows customized after installation.

I need detailed steps as I am new in using Wix installer.

like image 324
Laila Avatar asked Mar 14 '23 22:03

Laila


1 Answers

Here is how you can register your extension from wix:

First you need to define (in the product scope) custom actions to register/unregister your extension:

<Product>
    <!-- ... -->
    <CustomAction Id="InstallShell" FileKey="srm.exe" ExeCommand='install "[INSTALLFOLDER]\MyExtension.dll" -codebase' Execute="deferred" Return="check" Impersonate="no" />
    <CustomAction Id="UninstallShell" FileKey="srm.exe" ExeCommand='uninstall "[INSTALLFOLDER]\MyExtension.dll"' Execute="deferred" Return="check" Impersonate="no" />
</Product>

Then you need to customize the install execute sequence to launch these custom actions:

<Product>
    <!-- ... -->
    <InstallExecuteSequence>
        <Custom Action="InstallShell" After="InstallFiles">NOT Installed</Custom>
        <Custom Action="UninstallShell" Before="RemoveFiles">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
    </InstallExecuteSequence>
</Product>

"MyExtension.dll" is the id of your extension dll ressource in your wix project:

<Component Guid="*">
    <File Id="MyExtension.dll" KeyPath="yes" Source="bin\$(var.Configuration)\MyExtension.dll" />
</Component>

Same for srm.exe:

<Component Guid="*">
    <File Id="srm.exe" Source="packages\SharpShellTools.2.2.0.0\lib\srm.exe" KeyPath="yes" />
</Component>

You need to retrieve srm.exe associated to the version of Sharpshell you use (i recommend you to use the nuget package). You can find information on this here : http://www.codeproject.com/Articles/653780/NET-Shell-Extensions-Deploying-SharpShell-Servers

Hope it will help you ;)

like image 157
Tichau Avatar answered Apr 08 '23 00:04

Tichau