WiX Add Registry Key to Customize Context Menu

痴心易碎 提交于 2019-12-24 03:51:21

问题


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!

来源:https://stackoverflow.com/questions/27012090/wix-add-registry-key-to-customize-context-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!