简体   繁体   中英

Can I have Visual Studio 2013 run a Powershell command on File Save?

I have a powershell window constantly open, so that when I'm making edits to files that don't require recompile (like angular pages, Views, configs, images, etc), I can just run a command (I call it 'Sync'), and it will copy over the files I changed to my build directory, without having to do a Build.

Is it possible to have Visual Studio run that command when I do a Ctrl + S , or Ctrl + Shift + S ? The amount of time to Alt + Tab to the new window, run the command, then tab to the browser, seems inconsequential, but I do it dozens, if not hundreds, of times a day, and I know it would save time.

I'm not aware of an easy way to do this completely automatically on file save, but you may be able save yourself some trouble by using External Tools (under Tools / External Tools).

It's possible to substitute macros for things like the full path to the current file, etc. You get a menu item under Tools, and you can assign a keyboard shortcut to it.

在此处输入图片说明

Sounds like a job for a Visual Studio add-in. See this blog post by Scott Hanselman on how to write one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM