WiX Add Registry Key to Customize Context Menu

2.1k views Asked by At

I want to create an .msi installer that will add a cascading context menu when I right-click my mouse on my desktop. First, I tried doing this using the following script, and this works fine:

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\MyApp]
"MUIVerb"="My Application"
"SubCommands"="app1;app2"
"Position"=-

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app1]
@="Run App1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app1\command]
@="C:\\app1.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app2]
@="Run App2"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app2\command]
@="C:\\app2.exe"

However, when I tried doing the same in WiX toolset, this no longer works. I can view "My Application" when I right-click on the desktop, but there are no cascading menus ("Run App1" and "Run App2" are not displayed). Here's my XML code:

<DirectoryRef Id="TARGETDIR">
        <Component Id="RegistryEntries" Guid="ADF145F9-D3C0-4961-A463-812595B9BF60">
            <RegistryKey Root="HKCR"
                Key="DesktopBackground\Shell\MyApp"
                Action="createAndRemoveOnUninstall">
                <RegistryValue Type="string" Name="MUIVerb" Value="My Application" KeyPath="yes"/>
                <RegistryValue Type="string" Name="SubCommands" Value="app1;app2"/>
            </RegistryKey>
            <RegistryKey Root="HKLM"
            Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app1"
                Action="createAndRemoveOnUninstall">
                <RegistryValue Type="string" Value="Run App1"/>
                <RegistryValue Key="command" Type="string" Value="C:\app1.exe"/>
            </RegistryKey>
            <RegistryKey Root="HKLM"
                Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\app2"
                Action="createAndRemoveOnUninstall">
                <RegistryValue Type="string" Value="Run App2"/>
                <RegistryValue Key="command" Type="string" Value="C:\app2.exe"/>
            </RegistryKey>
        </Component>
    </DirectoryRef>

Please help me solve the problem. Do you have any suggestions? Thank you!

0

There are 0 answers