51

You're in Visual Studio... you press F5 (Run) and are greeted by this dialog:

There were build errors. Would you like to continue and run the last successful build?

Wonderful.

I'm sure there are cases where running the last successful build is useful, however, I have never purposefully answered yes to this question. Oh sure, I've clicked Yes plenty of times, and waiting in frustration for the first opportunity to undo my blunder, but nothing more.

So, have you ever found this feature useful? And if so, under what circumstances did it become helpful for you to be able to run the last successful build of your application?

How often do you accidentally click Yes and kick yourself while waiting for the app to start?

joshuapoehls
  • 32,695
  • 11
  • 50
  • 61
  • 5
    I've never wanted to click Yes to this dialog. A side question -- is there a setting that would skip this dialog with a default answer of no? – Austin Salonen Feb 27 '09 at 19:14
  • If it can launch the last successful run then it must still have the code somewhere. Why can't it just let you select to "restore code" to the last successful run? –  Oct 04 '11 at 08:01
  • It doesn't have the code. If the build failed, it is typically at the compilation stage, not the link, so the old binary hasn't been overwritten yet... – forsvarir Oct 04 '11 at 09:43
  • 3
    I have a scenario when this feature is useful. Imagine your boss coming to your room, asking what are you doing, and you want to show him, but you made some change to the code and it's not compiling ... :). Naaah ... it's stupid :D. Fortunately this feature can be turned off – ppiotrowicz Feb 27 '09 at 19:30

7 Answers7

44

In VS2008 there are the following options you can set to change the behavior (not sure if there are similar options in other versions of Visual Studio):

Projects and Solutions/Build and Run

    - On Run, when projects are out of date:

          Always build
          Never build
          Prompt to build <== default setting

    - On Run, when build or deployment errors occur:

          Launch old version
          Do not launch
          Prompt to launch <== default setting

Set the above options to "Always build" and "Do not launch" and you get what I consider a more ueseful behavior. Though sometimes when I try to launch the debugger and there's a build error it takes me a few seconds to realize why I'm not getting to the breakpoint I thought I'd be hitting (it might be nice to get some sort of 'toaster' type of message to knock me out of my stupor).

Michael Burr
  • 333,147
  • 50
  • 533
  • 760
  • 5
    ... and the same in VS2012. Tools->Options->Projects and Solutions->Build And Run. – Mark Robinson Mar 19 '13 at 13:55
  • 5
    Is there any way to do the same thing for Unit Tests? – Steve Pitchers Nov 05 '13 at 10:11
  • If your solution contains multiple projects and some of them failed to build, answering "yes" will run (or test) those that did build successfully. – Steve Pitchers Nov 11 '13 at 14:35
  • ... and the same in VS2013. Tools->Options->Projects and Solutions->Build And Run. – Josh Graham Apr 23 '14 at 19:38
  • @StevePitchers - There's an open VS suggestion for this: https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/11232930-hide-option-to-run-unit-tests-from-prior-build In the meantime, I wrote an AutoHotKey script to close it. The script is found if you follow that link since this question was closed and I can't submit an answer. – Jeff Lamb Mar 03 '16 at 15:50
  • OMG thank you! You have saved me many clicks! – Daniel Williams Jan 24 '20 at 20:27
7

This behaviour can be defined under Tools->Options->Projects and Solutions->Build And Run-> On Run, when Build or Deployment Errors occur

here you can select: - Launch old version - Do not launch - Ask to launch

6

This can be useful when you debug a web application and one of the pages does not compile, because some other developer checked in a bad version, or you can't check out the latest code for whatever reason, but you know you will not hit that page. I do it all the times.

cdonner
  • 37,019
  • 22
  • 105
  • 153
0

Interesting. I've actually never seen that dialog - I know there's an option to enable/disable running the previous successful build, so perhaps it shows a dialog first. You can look into disabling it if you won't use it.

One reason this can be useful, however, is if you want to remind yourself what the bug was that you were working on. Not all things can be fixed in edit-and-continue, and you might need a memory jog.

lc.
  • 113,939
  • 20
  • 158
  • 187
0

It's also helpful on web applications, because it will force the cassini servers to start. You need this if you are working on one project in the solution that won't compile, and you need to refresh the web services in another project.

kemiller2002
  • 113,795
  • 27
  • 197
  • 251
0

When using VS 2008 Express, there is a box to never show this dialog again. Just tried it and it will take away the dialog, leaving only a build failed message in the bottom left hand portion of the screen.

As for how often do I hit it, quite often. Frustrating as sometimes I have changed the code complete while testing things and will get something completely unrelated to the task at hand. Not sure when Microsoft figured this would be useful.

Terry
  • 319
  • 1
  • 3
  • 13
0

It works on the preference of selection of appropriate dll on runtime. Executables are not generated if there is any built error so the compiler looks for the executable which is existing which is obviously the last successful compiled.