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 has done it in many of his screen casts, but hasn’t shared the implementation.
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]
I used the External Tools to run a batch file that executes the default Rake task.
I assigned the shortcut key
CTRL + Sto the tool, so that, when I save, the rake task is triggered! I hope this helps someone looking to do the same thing.