While working in a large Visual Studio Solution with several numbers of projects, keeping track of currently active / working file is difficult. Tracking this will help us to understand where we are on the solution or which layer we are currently working on. If we can’t track it automatically, we have to scroll through entire solution explorer to find out the files or search for specific file inside solution explorer.
Keep track of active files is not a new feature of current version of Visual Studio. It is there since prior versions of Visual Studio. However I have seen many people still unaware of this great feature or not using this feature and spending lot of time just to find of where their files are.
If you want to locate the current file in editor inside Solution Explorer, you can just select the “Sync with Active Document” options as shown in picture below.
This will automatically highlight the file in Solution Explorer which is currently being edited or selected in code editor.
The only disadvantages of this approach is, you have to select the option manually every time you are changing a file within code editor.
How To Track it Automatically ?
you can do it in a much better way !
Navigate To Tools -> Options -> Projects and Solutions -> General -> ” Track Active Item in Solution Explorer” and check the option to turn on this feature automatically.
With this option enabled, when you open any code file in Visual Studio that you are editing the same file would get automatically highlighted inside of the solution Explorer.
Note that, when “Track Active Item in Solution Explorer” is enabled “Sync with Active Document” option won’t be available in Solution Explorer, as it is already automatically set for highlighting the current selected file
Here is how it looks like when “Track Active Item in Solution Explorer” is selected.
Hope this helps !