I'd like to add keyboard shortcut to Visual Studio package only once, during its installation. Basically I know how to do it from the package code, for example:
var dte = GetGlobalService(typeof(DTE)) as DTE2;
if (dte != null)
{
dte.Commands.Item("Tools.Something").Bindings = "Global::Ctrl+T, Ctrl+S";
}
The problem is, I'd like to invoke this code only once (I don't want to execute this code in package class constructor, because it will execute each time the package will be used first time after VS restart).
How to do it ?
There is another way I wasn't aware last time. All what need to be done is adding key binding in the *.vsct file. This will register your key shortcut and bind it to the selected command.
<KeyBindings>
<KeyBinding guid="guidSomehingCmdSet" id="cmdidSomehing" editor="guidVSStd97" mod1="Control" mod2="Control" key1="T" key2="S" />
</KeyBindings>