How to locate a file in Solution Explorer in Visual Studio 2010?

前端 未结 13 1295
盖世英雄少女心
盖世英雄少女心 2020-12-07 07:09

I have a huge solution with multiple projects. Sometime I need to navigate to a file in Solution Explorer. Using the VS 2010 \'Navigate To\

相关标签:
13条回答
  • 2020-12-07 07:53

    Brian Schmitt has a great Locate File in Solution Explorer – Visual Studio Macro post for this. The macro is extremely simple and quick. Basically it toggles the setting

    Tools->Options->Projects and Solutions->Track Active Item in Solution Explorer
    

    so that the current file ends up selected in the Solution Explorer but, because it is not left on, you don't get irritated by Solution Explorer nodes being expanded for all the files you access.

    Public Sub LocateFileInSolutionExplorer()
        DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
        DTE.ExecuteCommand("View.TrackActivityinSolutionExplorer")
        DTE.ExecuteCommand("View.SolutionExplorer")
    End Sub
    

    Bind a Keyboard ShortCut to this custom macro to effectively create what should be a built-in Visual Studio feature.

    0 讨论(0)
  • 2020-12-07 07:55

    Visual Studio 2012 has a new shortcut Ctrl [, S. Yes you have to type Ctrl [ and then release and then immediately type S (or click the little sync icon at the top of Solution Explored). It will synchronize to the item.

    Of course you can change the shortcut. I think I'll try Alt+L for locate.

    If you want to change the shortcut, it's command name under Options\Environment\Keyboard is SolutionExplorer.SyncWithActiveDocument.

    Usually this is more useful than always tracking, which in older versions always was a disaster because it would track 100 items in a row and then be jumping all over the place...

    0 讨论(0)
  • 2020-12-07 07:56

    Shift+Alt+L will find the current file in Solution Explorer in Visual Studio 2008+ with ReSharper installed.

    0 讨论(0)
  • 2020-12-07 07:56

    In Visual Studio 2010 you can turn on the "Track Active Item in Solution Explorer" option. This will mean whenever you switch between documents the new document gets selected in Solution Explorer. This can be irritating if your solution has lots of folders, because as you move around files in your solution all the folders will be left open.

    Visual Studio 2012 introduced the new "Sync with Active Document" feature. Three is a button for it at the top of Solution Explorer, or you can use the shortcut Ctrl + [, S.

    0 讨论(0)
  • 2020-12-07 08:00

    If you want to select the file in the solution explorer on command and don't want to install anything then I would recommend this macro.

    I've tested it, setting the shortcut to Alt+T, and I can confirm that it works with VS 2010.

    Thanks to Dan Vanderboom for writing it.

    0 讨论(0)
  • 2020-12-07 08:03

    I know its little too late, but hope it helps someone else. The best option now is to install Microsoft Visual Studio add on called - Productivity Power Tools.

    http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef

    With this comes "Solution Navigator" (alternative to Solution Explorer, with a lot of benefits) - which then you can use to filter the files to only show "Open". You can even filter files to show "Edited" and "Unsaved".

    0 讨论(0)
提交回复
热议问题