Visual Studio Keyboard Shortcut / Hot key to Publish Current File

Viewed 5446

I'm aware of Build.PublishSelection as a shortcut to pull up the publish project window (and publish the entire project), but I would like to bind something to publish just the current file I'm editing. You can right click the file in solution explorer and publish it, but I have to do this 200+ times a day and those seconds add up.

Any hotkey command to do this or other possible workaround?

3 Answers

In Visual Studio Enterprise 2017 this is the shortcut sequence (basically a path to the publish menu item):

  1. Alt+B - opens the "Build" menu
  2. H - selects: "Publish your_solution_name", selects the "Publish" button
  3. Enter - confirms

Visual Studio 2022: Alt + B, H and hit Enter.

Visual Studio 2019: Alt + B, H and hit Enter.

Visual Studio 2017: Alt + ', Alt + P and hit Enter.

Creating a shortcut (works in any version): Go to Tools > Options > Environment > Keyboard, look for Build.PublishSelection, in Press shortcut keys type e.g. Alt + P and click on Assign.

Related