如何制作运行 VSIX 方法的快捷方式? [英] How to make a shortcut to run a VSIX method?

查看:35
本文介绍了如何制作运行 VSIX 方法的快捷方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参阅这个问题.

最初的问题解决了,我的扩展中有一个方法.我希望当用户安装扩展程序时,也应该安装一个键盘快捷键,并且应该在按下时运行该方法.

The initial question was solved, and I have a method in my extension. I want that when the user installs the extension, a keyboard-shortcut should be installed as well, and should run the method when pressed.

我该怎么做?

推荐答案

您可以向 .vsct 文件添加快捷方式.当您生成一个新扩展并说它将有一个菜单命令时,该文件会在向导中自动创建.手动添加:

You can add shortcuts to the .vsct file. This file is created automatically in the wizard when you generate a new extension and say it will have a menu command. To add it manually:

  • 创建 MyCommands.vsct
  • 将文件属性设置为 VSCTCompile
  • 卸载您的项目,右键单击并编辑项目:
<VSCTCompile Include="MyCommands.vsct">
    <ResourceName>Menus.ctmenu</ResourceName>
    <SubType>Designer</SubType>
</VSCTCompile>

  • 声明您的项目将具有菜单和快捷方式:
  • [ProvideMenuResource("Menus.ctmenu",1)]
    public sealed class MyPackage : Package
    

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆