How Visual Studio automatically searches for source code when debugging

Given:

  • dll, which was built in the directory "A"
  • debug PC with source code placed in directory "B"

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

To avoid this dialog box (and the associated view) appearing, is there any point in Visual Studio automatically looking for the source code in "B"?

+6
source share
2 answers

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

This property page indicates where the debugger will search for source files when debugging a solution.

To access the Debug source file properties page, right-click your solution in Solution Explorer and select Properties from the context menu. Expand the General Properties folder and open the Debug Source Files page.

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

Do not search for these source files
Enter the names of the files that you do not want to read to the debugger. If the debugger finds one of these files in one of the above directories, it ignores it. If the Find Source dialog box appears during debugging and you click Cancel, the file you were looking for is added to this list so that the debugger does not continue to search for this file.

+6
source

You can automate source code searches using the autoHotKey script tool: it will open the correct source code well without user input. When you first search for a file, it will take a few seconds, and then it will become instant.

The script code is below. It is used with VS2010:

SourcesRoot = D:\MySourceCodeIsHere Loop { WinWait, Find Source:, IfWinNotActive, Find Source: , , WinActivate, Find Source:, WinWaitActive, Find Source:, ControlGetText, Filename, Edit1, Loop, %SourcesRoot%\%Filename%, , 1 { ControlSetText, Edit1, %A_LoopFileFullPath% break } ControlClick Button2 } 
+1
source

Source: https://habr.com/ru/post/915495/


All Articles