Search code examples
visual-studiodebuggingvisual-studio-debugging

How to have Visual Studio automatically search for source code when debugging


Given:

  • a dll which has been built in directory "A"
  • a debugging PC with source code put in directory "B"

Then when debugging, VisualStudio will search for source code in "A", will not find it (as it is in "B"), and will display the dialog called "Find Source". Then you will browse to the correct location of source file, and everything will work fine.

In order to avoid this dialog to appear (and its associated browsing), is there a mean to have Visual Studio automatically look for source code in "B" ?


Solution

  • It seems that you have set some configuration related to debugging in project.

    This property page specifies where the debugger will look for source files when debugging the solution.

    To access the Debug Source Files property page, right-click on your Solution in Solution Explorer and select Properties from the shortcut menu. Expand the Common Properties folder, and click the Debug Source Files page.

    Directories containing source code
    Contains a list of directories in which the debugger searches for source files when debugging the solution.

    Do not look for these source files
    Enter the names of any files that you do not want the debugger to read. If the debugger finds one of these files in one of the directories specified above, it will ignore it. If the Find Source dialog box comes up while you are debugging and , you click Cancel, the file you were searching for gets added to this list so that the debugger will not continue searching for that file.