5

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.

4

1 回答 1

0

工具 > 选项 > 项目和解决方案 > 构建和运行 > “运行时,当项目过期时:” > 从不构建

这是一个 AutoHotKey 脚本,我用来在“提示构建”(使用 Ctrl+1)和“从不构建”(使用 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
于 2016-01-13T20:41:12.247 回答