Last Updated: February 25, 2016
· keboo

Visual Studio not compiling projects when clicking the Debug button

This problem has caused me many hours of grief due to how long I just put up with it before looking for a solution. How the setting got changed is still a mystery to me.

The problem manifested itself when I set a breakpoint and proceeded to hit the Debug button in VS 2010. It is important to note that I had the setting "Require source files to exactly match the original version" (Tools>>Options>>Debugging>>General) enabled. After my program started, the break point was disabled. The tooltip on it indicated that it was because my source file was different then my current version. Frustrated I closed my program, rebuilt my project and was then able to stop at my break point and step through my code. After having to rebuild my project before each debug session, I eventually got frustrated enough to start searching for the solution.

Thankfully it turned out to be simple.

Tools>>Options>>Projects and Solutions>>Build and Run

The setting for "Before building" was set to "Save all changes" and the setting for "On Run, when projects are out of date" was set to "Never build." So every time I tried to debug it would save all of my changes, but would not build my project. Guaranteeing that any modified file would not be able to be debugged since it would always be difference then the previously built version. The simple solution was to change the value of "On Run, when projects are out of date" to "Prompt to build" (or "Always build" if you so desire).

Here hoping this saves you some of the frustration I went through.


Say Thanks