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.
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 ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With