每次在 Visual Studio 中保存文件时如何运行 Rake 任务? [英] How do I run a Rake task every time a file is saved in Visual Studio?
问题描述
如何在每次在 Visual Studio 中保存文件时自动运行 rake 脚本?我可以创建一个包装命令的批处理文件.我想在 CTRL + S
上触发它.但是,Visual Studio 2012 没有宏.
How do I run a rake script automatically every time I save a file in Visual Studio? I can create a batch file that wraps the command. And I'd like to trigger it on CTRL + S
. But, Visual Studio 2012 doesn't have macros.
JP Boodhoo 在他的许多屏幕投射中都做到了,但没有分享实现.
JP Boodhoo has done it in many of his screen casts, but hasn't shared the implementation.
仅供参考,我的rakefile
看起来像这样
FYI, my rakefile
looks like this
require 'albacore'
desc 'Build Solution'
msbuild :Build do |msb|
msb.properties :configuration => :Release
msb.targets :Clean, :Build
msb.solution = 'ProjoBot.sln'
end
desc 'Run Unit Tests'
mspec :Test do |mspec|
mspec.command = 'Lib/Tools/MSpec/mspec-clr4.exe'
mspec.assemblies 'Src/Tests/ProjoBot.UnitSpecifications/bin/Release/ProjoBot.UnitSpecifications.dll'
end
task :default => [:Build, :Test]
推荐答案
我使用外部工具来运行一个批处理文件,该文件执行默认的 Rake 任务.
I used the External Tools to run a batch file that executes the default Rake task.
@ECHO OFF
rake
我为工具指定了快捷键CTRL + S
,这样,当我保存时,就会触发rake任务!我希望这能帮助那些想做同样事情的人.
I assigned the shortcut key CTRL + S
to the tool, so that, when I save, the rake task is triggered! I hope this helps someone looking to do the same thing.
这篇关于每次在 Visual Studio 中保存文件时如何运行 Rake 任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!