Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a custom command to Visual Studio?

Tags:

There's an external command I'm using constantly - basically launching a batch file. I'd like to put a toolbar button (and possibly keyboard shortcut) for this into the IDE. Is there an easy way to do that?

like image 621
Billy ONeal Avatar asked Jun 20 '11 17:06

Billy ONeal


People also ask

How do I add a command in Visual Studio?

In the Solution Explorer, right-click the project node and select Add > New Item. In the Add New Item dialog, go to Visual C# > Extensibility and select Command. In the Name field at the bottom of the window, change the command file name to FirstCommand.

How do you add a command palette in VS Code?

Command Palette# VS Code is equally accessible from the keyboard. The most important key combination to know is Ctrl+Shift+P, which brings up the Command Palette. From here, you have access to all of the functionality of VS Code, including keyboard shortcuts for the most common operations.


2 Answers

First, add an item to your Tools menu by choosing Tools, External Tools, and filling out the dialog, like this:

enter image description here

Then bring up Tools Customize, click the Keyboard button at the bottom, and find the appropriate external tool number:

bind to a key

like image 80
Kate Gregory Avatar answered Sep 28 '22 01:09

Kate Gregory


All the configured external commands in VS are available to add to a Toolbar or Menu through the Tools>Customize menu as "External Command ##". You just need to know which number corresponds to the particular command you've configured. I believe it is in order of entry in the external commands list.

Similarly, you can find those names in the commands list in Options>Environment>Keyboard and assign a shortcut to your command that way.

like image 29
bronsoja Avatar answered Sep 28 '22 00:09

bronsoja