强制的Visual Studio调试时总是'重建所有' [英] Force visual studio to always 'rebuild all' when debugging

查看:546
本文介绍了强制的Visual Studio调试时总是'重建所有'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:基本上,我需要的是为Visual Studio总是重建所有当我打调试

Basically what I need is for visual studio to always rebuild all when I hit debug.

我目前使用Visual Studio编译我的汇编程序,使用MASM和一般它的正常工作。

I'm currently using visual studio to compile my assembly programs, using MASM and in general it's working fine.

不过我碰到一个恼人的问题:

However I've run into an annoying issue:

如果我包括文件(比如,用函数的文件),像这样

If I include a file (say, a file with functions) like this

Include functions.inc

和编译它,它最初工作正常。但是,如果我当时的变更的functions.inc的内容,这不是承认和编译器跳过functions.inc和以前我改变它使用的旧版本。

and compile it, it originally works fine. However if I then change the contents of functions.inc, this is not recognized and the compilers skips over functions.inc and uses the old version from before I changed it.

我找不到任何地方的选项下,项目属性来解决这个问题。但我敢肯定它是与连接选项或东西 - 如果我做下的项目属性的任何变化(即使我改变的东西,改回去,然后preSS OK),它不正确地与编译新版本functions.inc的。

I cannot find an option anywhere under project properties to fix this. However I'm sure it has something to do with linker options or something - if I make any changes under project properties (even if I change something and change it back, and then press OK), it does compile properly with the new version of functions.inc.

任何想法?

推荐答案

您可以更改通过在Visual Studio的宏资源管理器的 EnvironmentEvents 宏的行为:

You can change the behaviour via the EnvironmentEvents macro in Visual Studio's Macro Explorer:

Private Enum IDEMode
    Design = 1
    Break = 2
    Run = 3
End Enum

Private _IDEMode As IDEMode = IDEMode.Design

Public Sub DTEDebuggerEvents_OnDebugRun() Handles _
DebuggerEvents.OnEnterRunMode
    If _IDEMode = IDEMode.Design Then
        DTE.ExecuteCommand("Build.RebuildSolution")
    End If
    _IDEMode = IDEMode.Run
End Sub

Public Sub DTEDebuggerEvents_OnDebugDesign() Handles _
    DebuggerEvents.OnEnterDesignMode
    _IDEMode = IDEMode.Design
End Sub

Public Sub DTEDebuggerEvents_OnDebugBreak() Handles _
    DebuggerEvents.OnEnterBreakMode
    _IDEMode = IDEMode.Break
End Sub

这是一个变化的VisualStudio,因此将在一次设置的所有解决方案的工作

This is a VisualStudio change so it will work across all solutions once set

更新
上述解决方案的工作原理,但它有关于内容文件,其中即使调试器运行IDE将改变设计模式的一些缺陷。它的将会的尝试,而调试器在某些情况下运行的建立。妥善解决是这样的:

UPDATE The above solution works, however it has some pitfalls concerning content files where the IDE will change to design mode even if the debugger is running. It will try to build while the debugger is running in some situations. The proper solution is this:

Private _curDebugState As EnvDTE80.dbgProcessState

Public Sub debuggerStateChangedHandler
    (ByVal NewProcess As EnvDTE.Process, 
    ByVal processState As EnvDTE80.dbgProcessState) 
    Handles DebuggerProcessEvents.OnProcessStateChanged
    If _curDebugState = dbgProcessState.dbgProcessStateStop And processState = dbgProcessState.dbgProcessStateRun Then
        DTE.ExecuteCommand("Build.RebuildSolution")
    End If
    _curDebugState = processState
End Sub

这篇关于强制的Visual Studio调试时总是'重建所有'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆