5
votes

I've turned off the dialog "build failed do you want to launch last successful build", and don't want to turn it back on. Is there a way to manually (menu command, macro) launch the last successful build, without having to start a build at all? This is useful to show something to another person while I'm the middle of coding and I've broken the build (or simply don't want to wait for the next compilation, whether it succeeds or fails).

Launching the exe in the bin folder doesn't work, first because it doesn't have the current command-line argument & working directory setup in the build options, and secondly I get asserts: apparently it's expecting to be attached to the debugger (which I think we still have with the "last successful build" dialog?). This is for Visual C++ 2010.

1

1 Answers

0
votes

Tools > Options > Projects and Solutions > Build and Run > "On Run, when projects are out of date:" > Never build

Here is an AutoHotKey script that I use to toggle between "Prompt for build" (using Ctrl+1) and "Never build" (using Ctrl+2).

ToggleBuildBeforeRun(skipBuild)
{
    SetTitleMatchMode, 2
    IfWinActive, Visual Studio
    {
        Send !to^ebuild{Space}and{Space}run

        Sleep 800
        Send {Tab 4}{Down 2}

        if (skipBuild)
        {
            Send {Up 1}
        }

        Sleep 600
        Send {Enter}
    }
}

^1::
ToggleBuildBeforeRun(false)
return

^2::
ToggleBuildBeforeRun(true)
return