[英]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. 我有一个不断打开的Powershell窗口,因此当我对不需要重新编译的文件(例如,角度页面,视图,配置,图像等)进行编辑时,我只需运行命令即可(我称其为“同步” '),它将复制我更改到构建目录的文件,而无需进行构建。
Is it possible to have Visual Studio run that command when I do a Ctrl + S , or Ctrl + Shift + S ? 当我执行Ctrl + S或Ctrl + Shift + S时,是否可以让Visual Studio运行该命令? 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. 到Alt + Tab到新窗口,运行命令,再到浏览器的Tab的时间似乎无关紧要,但是我每天这样做数十次(如果不是几百次),我知道这样可以节省时间。
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. 可以用宏代替当前文件的完整路径等内容。您可以在“工具”下找到一个菜单项,并可以为其分配键盘快捷键。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.