Visual Studio Keyboard Shortcut / Hot key to Publish Current File
Asked Answered
P

3

8

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?

Pohai answered 24/3, 2016 at 16:4 Comment(1)
You should use msbuildLeatrice
D
7

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
Dayledaylight answered 16/4, 2019 at 9:33 Comment(3)
just fyi, my favorite way to publish is, right click on the toolbar and enable Web One Click Publish toolbar. Then you get one button to click to do it. Also, this used to be able to be bound to a key in vs2010 and earlier.Leopardi
@rocketsarefast, but how to assign a shortcut for that action?Forgather
@Aviw, i cant assign a keyboard shortcut to the toolbar button unfortunately, but at least its just one mouse click. Not great but better than nothing.Leopardi
C
5

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.

Carabineer answered 14/1, 2018 at 21:33 Comment(0)
I
3

For Visual Studio 2015:

Alt + ¨, Alt + P will publish the currently selected file(s).

The ¨ key is the one just left of the enter key.

Included answered 20/5, 2016 at 8:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.