Resetting the source code associations in the Visual Studio debugger

Have you ever been debugging and found yourself looking at the wrong source code?  Typically, this happens to me when I just hit the escape key at the dialog prompting me for the source file.  I was recently asked how to reset the source code association by one of the folks here.  After a few minutes of trial and error (restarting debugging, etc), I remembered that source file associations are stored as part of the solution's user options.

To update the source code search paths in the Visual Studio debugger, do the following:

  1. In the Solution Explorer, right click on the solution name (ex: Solution 'TestApplication') and select Properties
    This will bring up the Solution Property Pages dialog
  2. Under Common Properties, select Debug Source Files
  3. In the Search these paths for source code files (Visual Studio .NET 2003) / Directories containing source code (Visual Studio 2005) box, add, remove and/or reorder the directories as desired
  4. Click the OK button

Once you have done the above steps, I recommend closing the incorrectly associated source files (to avoid any confusion later on), then reload the desired file(s).  While stopped in the debugger, you can do this by double clicking on the desired frame in the Call Stack window (or right clicking the frame and selecting Go To Source Code).

Take care,
-- DK

Disclaimer(s):
This posting is provided "AS IS" with no warranties, and confers no rights.
Some of the information contained within this post may be in relation to beta software. Any and all details are subject to change.