简体   繁体   English

键盘快捷方式不适用于VSIX安装程序

[英]Keyboard Shortcut Not Working with VSIX Installer

I've created a VSIX Package, and I've added the KeyBindings Section in my .vsct file. 我已经创建了VSIX程序包,并在.vsct文件中添加了KeyBindings部分。 When I run an experimental instance of Visual Studio, the keyboard shortcut works, but when I actually install the vsix package on my machine, the keyboard shortcut doesn't work, despite the other aspects of the addin working. 当我运行Visual Studio的实验性实例时,键盘快捷方式有效,但是当我在计算机上实际安装vsix软件包时,尽管外接程序的其他方面起作用,键盘快捷方式也无法使用。 Is there anything else that would be stopping the shortcut from binding properly? 还有其他什么可以阻止快捷方式正确绑定吗?

The Key Bindings 按键绑定

<KeyBindings>
        <KeyBinding guid="MyAddinCmdSet" id="cmdidRollback" editor="guidVSStd97" key1="VK_NUMPAD2" mod1="CONTROL"/>         
</KeyBindings>

The Command in my vspackage vspackage中的命令

CommandID CommandIDRollback = new CommandID(GuidList.MyAddinCmdSet, (int)PkgCmdIDList.cmdidRollback);
                MenuCommand menuItemRollback = new MenuCommand(MenuItemCallbackRollback, CommandIDRollback);
                mcs.AddCommand( menuItemRollback);

key1="VK_NUMPAD2" is Numeric keypad 2 key, and doesn't work with the "2 K" keyboard , you can use key one code 0x32 , but this shortcut already reserved for QueryDesigner.Criterria() so you can't use it. key1="VK_NUMPAD2"是数字小键盘2键,并且不适用于“ 2 K”键盘,您可以使用一个键代码0x32 ,但是该快捷方式已经为QueryDesigner.Criterria()保留,因此您不能使用它。

If you target the Numeric keypad and it doesn't work you have to make sure this shortcut doesn't reserved for visual studio functionality. 如果您将数字小键盘作为目标,但无法使用,则必须确保此快捷方式没有保留给Visual Studio功能使用。

For key code see Virtual-Key Codes . 有关密钥代码,请参见虚拟密钥代码

change your code as the below : 如下更改代码:

<KeyBindings>
   <KeyBinding guid="MyAddinCmdSet" id="cmdidRollback" editor="guidVSStd97" key1="0x32" mod1="CONTROL"/>         
</KeyBindings>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM