About the author

Steven Harmansteven harman :: makes sweet software with computers!

For recent posts and more about me, scroll to the bottom.

Sponsors

Subscribe

  • Subscribe to my feed. via RSS
  • Subscribe via email via email

Visual Studio Tip: Kill that Build!

At the day job I spend the majority of my time in Visual Studio, writing, refactoring, debugging, and banging my face against code. C# code specifically.

And what is my #1 complaint about C#? The Compilation Tax.

I get over taxed!

Compiling!I have a little problem that causes me to pay that tax more often that I think I ought to. I have some kind of weird internal clock that causes my fingers to issue the Ctrl + S, Ctrl + Shift + B keystrokes every five minutes, causing the IDE to freeze up while it compiles my project.

And that really sucks as most of the time I didn’t want to compile, usually because I knew the code wasn’t complete and the compiler was going to yell at me.

But what am I going to do? They are my fingers and I love them, despite how much they like to torture me by making me wait for the compiler to finish doing its thang.

Make it stop... please?

Then today it hit me. Why not just kill the build?

Kill that build!I checked to see if Sara had any tips for the best way to get that done, but didn’t find any. No worries, I checked the keyboard bindings and found that Ctrl + Break does just what I need, cancels the currently running build!

Sure, this might be a really basic and obvious keyboard shortcut to anyone that already knows about it, but its a big, time-saving, deal to me. :)

Technorati Tags: , ,

What others are saying.

# Visual Studio Tip: Kill That Build!
Gravatar DotNetKicks.com
Jan 17, 2008
You've been kicked (a good thing) - Trackback from DotNetKicks.com
# re: Visual Studio Tip: Kill that Build!
Gravatar John S.
Jan 17, 2008
You can Ctrl-Shift-B without saving first, it will save everything included in the build automatically (assuming Options > Projects and Solutions > Build and Run > 'Before building' is set to 'Save all changes' which I think is the default)
# re: Visual Studio Tip: Kill that Build!
Gravatar Steven Harman
Jan 17, 2008
@John, Yep... I Ctrl+Shift+B by itself too to auto-save and build. But when I do that I usually intend to compile my code, whereas the in example in the post I was saying that my fingers often trigger a build even when I didn't mean to. They have a mind of their own I tell ya! :)

At any rate, I was just trying to point out that it's trivially easy to cancel a build if you need/want to.
# re: Visual Studio Tip: Kill that Build!
Gravatar Matt Blodgett
Jan 17, 2008
Another reason why ReSharper is essential for productive C# development, IMO.
# re: Visual Studio Tip: Kill that Build!
Gravatar Steven Harman
Jan 18, 2008
Yes, and I do <3 my ReSharper! Now if they'd just drop the EAP bits for the 4.0 release I could finally get some decent support in my .net 3.5 codebase! :)
# re: Visual Studio Tip: Kill that Build!
Gravatar Jon Kruger
Jan 18, 2008
Back in the day when we had slower machines, I used to have two copies of the code on my machine. So while one was compiling I would go work on something else in the other instance of Visual Studio. Luckily compilation times aren't too bad these days.
# re: Visual Studio Tip: Kill that Build!
Gravatar Jason
Jan 18, 2008
Thanks so much Steve, you have no idea how much time and frustration this will save me.
# re: Visual Studio Tip: Kill that Build!
Gravatar Joe Brinkman
Jan 18, 2008
The C# team needs to get its act together. Even Java has background compilation. This is one reason I loves me some VB.
# re: Visual Studio Tip: Kill that Build!
Gravatar Steven Harman
Jan 18, 2008
@Jon, wait... so you had slower machines yet you'd be running two instance of Visual Studio? I bet that had a pretty large impact on performance considering the small amounts of RAM we had back in the day. :)

@Joe, Yeah yeah, VB-whateva'! Maybe I'll just make the jump to Ruby or one of the other interpreted languages and leave the compiler behind. :)
# re: Visual Studio Tip: Kill that Build!
Gravatar Brian Lowry
Jan 21, 2008
Hi Steve, I had the same complaint awhile back and ran into this Macro that will kill the build when an error is thrown. Saves time and I don't have to manually break...

I added this module under "MyMacros"... tools-macros-macros ide...

   1:  Option Strict Off
   2:  Option Explicit Off
   3:  Imports System
   4:  Imports EnvDTE
   5:  Imports EnvDTE80
   6:  Imports System.Diagnostics
   7:   
   8:  Public Module EnvironmentEvents
   9:   
  10:  Private Sub BuildEvents_OnBuildProjConfigDone( _
  11:    ByVal Project As String, _
  12:    ByVal ProjectConfig As String, _
  13:    ByVal Platform As String, ByVal SolutionConfig As String, _
  14:    ByVal Success As Boolean) _
  15:    Handles BuildEvents.OnBuildProjConfigDone
  16:   
  17:    If Success = False Then
  18:      'The build failed...cancel any further builds.
  19:      DTE.ExecuteCommand("Build.Cancel")
  20:    End If
  21:  End Sub
  22:   
  23:  End Module
# re: Visual Studio Tip: Kill that Build!
Gravatar Brian Lowry
Jan 21, 2008
The code for the build macro.
# Jan 24th Links: ASP.NET, ASP.NET AJAX, Visual Studio, .NET, IIS
Gravatar ScottGu's Blog
Jan 25, 2008
I just arrived back from my trip from Asia, and decided to celebrate (since I'm jet-lagged and can't
# Jan 24th Links: ASP.NET, ASP.NET AJAX, Visual Studio, .NET, IIS
I just arrived back from my trip from Asia, and decided to celebrate (since I'm jet-lagged and can't
# Jan 24th Links: ASP.NET, ASP.NET AJAX, Visual Studio, .NET, IIS
Gravatar Top ASP.NET Items
Jan 25, 2008
I just arrived back from my trip from Asia, and decided to celebrate (since I'm jet-lagged and can't
# re: Visual Studio Tip: Kill that Build!
Gravatar Neil Mosafi
Jan 25, 2008
Isn't this fairly obvious? When you are in the middle of a build, if you go the "build" menu it says

Cancel Ctrl + Break
# re: Visual Studio Tip: Kill that Build!
Gravatar Steven Harman
Jan 25, 2008
@Neil, Yes it is very obvious... once you know it exists.

And seeing as I rarely use my mouse to navigate or get things done in Visual Studio, I'd never seen that menu option before. I'm all about speed and low friction - and nothing is lower friction for me than speeding around with keyboard shortcuts. :)
# 1月24日链接篇: ASP.NET, ASP.NET AJAX, Visual Studio, .NET, IIS
Gravatar Joycode@Ab110.com
Jan 25, 2008
【原文地址】 Jan 24th Links: ASP.NET, ASP.NET AJAX, Visual Studio, .NET, IIS 【原文发表日期】 Thursday, January 24
# re: Visual Studio Tip: Kill that Build!
Gravatar Chris
Jan 25, 2008
You'd have to be born yesterday to not know about CTRL-BREAK in VStudio. It has been the standard way to stop a process for decades.
# re: Visual Studio Tip: Kill that Build!
Gravatar Steven Harman
Jan 25, 2008
@Chris, Well then I guess I should invite you to my birthday party... it's 1 year from yesterday. :)

Oh, and by the way - talking down to people is a sure fire way to get them to listen. Good job!
# re: Visual Studio Tip: Kill that Build!
Gravatar Chris
Jan 25, 2008
>talking down to people is a sure fire way to get them to
>listen. Good job!

Yes, good job indeed. You replied, so you listened.
# re: Visual Studio Tip: Kill that Build!
Gravatar Chris
Jan 25, 2008
And thank you for the invite!
# Jan 24th Links: ASP.NET, ASP.NET AJAX, Visual Studio, .NET, IIS
Gravatar Programming
Jan 27, 2008
I just arrived back from my trip from Asia, and decided to celebrate (since I&#39;m jet-lagged and can&#39;t
# re: Visual Studio Tip: Kill that Build!
Gravatar Brian Lowry
Jan 29, 2008
@Chris

Nothing wrong with passing information along to other developers who may not be as talented, dedicated, hard-working, or as smart as you appear. Right?
# 
Gravatar Mutamblog
Feb 01, 2008
Links 24/Jan: ASP.NET, ASP.NET AJAX, Visual Studio, .NET, IIS
# re: Visual Studio Tip: Kill that Build!
Gravatar Casey
Feb 05, 2008
Great tip! I had been looking for that one since my fingers get ahead of my brain with the ctrl-shift-b so often.
# 1月24日链接篇: ASP.NET, ASP.NET AJAX, Visual Studio, .NET, IIS
Gravatar ASP.NET Chinese Blogs
Feb 07, 2008
【原文地址】 Jan 24th Links: ASP.NET, ASP.NET AJAX, Visual Studio, .NET, IIS 【原文发表日期】 Thursday, January 24
# Stop je build direct
Gravatar Marcel de Kleine
Feb 10, 2008
Heb je wel eens, start je je build terwijl je bedenkt dat er nog iets fout zit. Dan maar wachten tot
# vs2008 相关更新
Gravatar 曹振华
Feb 13, 2008
ASP.NETMVC框架路线图更新【原文地址】ASP.NETMVCFrameworkRoad-MapUpdate【原文发表日期】Tuesday,February12,200...
# Jan 24th Links: ASP.NET, ASP.NET AJAX, Visual Studio, .NET, IIS
Gravatar Mirrored Blogs
Feb 20, 2008
I just arrived back from my trip from Asia, and decided to celebrate (since I&#39;m jet-lagged and can&#39;t
Comments have been closed on this topic.