The answer is partially found.
You just need to create a standard project - Visual Stutio Package. Select Menu Command as the interface in the dialog box when creating (first option). Then open the .vsct file and change the parent of the group:
<Groups> <Group guid="guidVSPackageCmdSet" id="MyMenuGroup" priority="0x0600"> <Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_CODEWIN"/> </Group> </Groups>
Exactly
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_CODEWIN"/>
Binds a group (with a button) to the menu that appears when you right-click in the code. The id of this menu IDM_VS_CTXT_CODEWIN and the standard guid guidSHLMainMenu are important here. You can view other id and guid (better in VS - there with a description) https://msdn.microsoft.com/ru-ru/library/vstudio/microsoft.visualstudio.shell.vsmenus_members(v=vs.100).aspx# mainBody
You can write anything in the handler and it will work.
private void MenuItemCallback(object sender, EventArgs e) { MessageBox.Show("Уже что-то заработало!!!"); }