WiX添加注册表项以自定义上下文菜单

时间:2014-11-19 08:27:14

标签: windows wix registry contextmenu registrykey

我想创建一个.msi安装程序,当我在桌面上右键单击鼠标时,它将添加一个级联上下文菜单。首先,我尝试使用以下脚本执行此操作,这很好用:

[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"

但是,当我尝试在WiX工具集中执行相同操作时,这不再有效。我可以查看"我的应用程序"当我右键单击桌面时,但没有级联菜单("运行App1""运行App2"不显示)。这是我的XML代码:

<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>

请帮我解决问题。你有什么建议吗?谢谢!

0 个答案:

没有答案