ChatGPT解决这个技术问题 Extra ChatGPT

How to search for file names in Visual Studio?

In Eclipse you can search for a file in the project by pressing CTRL-SHIFT-R.

Is there a way to do this in Visual Studio?

ps, i know this question was asked earlier, but the better, more correct answer is in the linked file.
No offense, but this feels horrible after CTRL+p of sublime text.

C
Community

Just for anyone else landing on this page from Google or elsewhere, this answer is probably the best answer out of all of them.

To summarize, simply hit:

CTRL + ,

And then start typing the file name.


I probably waste 30 minutes every day just looking for the correct file in the Solution Explorer. This is my new favorite shortcut!
This shows method names as well though, bit annoying.
Unfortunately that doesn't limit the search to filenames, it also includes symbols
Not sure if this accurately answers the question, this thing searches for symbols as wells (methods etc) which is very annoying in a large project. Furthermore, the same thing could be achieved by Ctrl+; which is shortcut for search in solution explorer.
@marsh In VS 2017.3 (and possibly earlier) Ctrl-, behaves like a command window somewhat. If you give it the 'f' command and provide a file name, it will search only files: e.g. "f someFile.cpp". There's also a button that prepends the "f" if you prefer clicking.
V
Vimes

In VS2013 you can click in the solution explorer for this functionality.

The shortcut is:

ctrl + ;

https://i.stack.imgur.com/yDVov.jpg

To search only the names of files, and not the contents (especially in C#), uncheck these options:

https://i.stack.imgur.com/kWM7N.png


Great and useful. I am using VS 2019 preview and it works perfectly fine for me.
L
Legends

The best option now is to install Microsoft Visual Studio add on called Productivity Power Tools (VS 2010 version, VS 2013 version).

With this comes "Solution Navigator" (alternative to Solution Explorer, with a lot of benefits).

https://weblogs.asp.net/blogs/scottgu/image_thumb_50CCDCE6.png

BTW, this feature is built-in into Visual Studio 2012.


Built in to 2017!
S
Sajeetharan

With Visual Studio 2017, It now comes with a much better version, named “Go To All” and is bound to the keyboard shortcut CTRL + T as well as CTRL +, and includes inline filtering and “fuzzy search”

CTRL + T

CTRL + ,


YES, finally they added a built-in way to filter only by filenames! Type f, space, then the filename. Example: CTRL+T then f MyClass, then ↓ on your keyboard until you get to the matching file. This method is superior to the solution explorer search (which wastes space by showing both filenames and class names) in that it is strictly filenames only.
You can even add a custom keyboard shortcut in Tools -> Options -> Keyboard -> Edit.GoToFile which adds the f for you.
The default for Edit.GoToFile is Ctrl+1, Ctrl+F. There are more with Ctrl+1, Ctrl+<key>. F=Files, M=Members, R=Recent Files, T=Types
Link in answer is dead - domain is for sale.
M
Mwiza

Easily hit CTRL+SHIFT+T . This will look in the files' names.


This is super useful! Thanks for sharing.
k
kirkus

In the search dropdown on the standard toolbar, you can use the "open file" macro, >of, to find files. Click in said dropdown (or hit Ctrl-D) then start typing (minus the quotes) ">of CoreEdit.cs", and you'll get a dynamic list that narrows as you type.


K
Kyle

In Visual Studio 2017 you can search directly for files with Ctrl+1, Ctrl+F (Keyboard command: Edit.GoToFile).

Alternatively, you can use Ctrl+t or Ctrl+, (the Edit.GoToAll command) and start your search with f.


I
Ian Boyd

I use usysware DPack: http://www.usysware.com/dpack/

Then I just press ALT-U start typing the filename and choose the correct file. DPack also has other nice features.

https://i.stack.imgur.com/y8RbF.png

(highlights added for screenshot)

Note: Will not work in Express editons of Visual Studio, since they don't allow plugins.


interesting, does it conflict with resharper do you know?
Works for me, but resharper got file search ctrl-shift-t
i already use DPack (Delphi Pack) for their brief bookmarks. i didn't realize they also had unit search. Sad that Delphi's 10 year old IDE is more developer friendly than Visual Studio. People don't realize what they're missing; how sloppy VS is.
a
adrianbanks

Since you mention ReSharper in a comment:

You can do this in ReSharper by using the "Goto File..." option (Ctrl-Shift-N or ReSharper -> Go To -> File...) in my key mappings.


@Andomar: Yes, it depends on whether you have the Visual Studio or IDEA shortcuts configured.
M
Mwiza

CTRL + P this searches for the file name your direct answer.


Not true for Visual Studio, only vs code. This actually opens the print dialog.
P
Pang

I'd recommend PhatStudio if you're using upto VS 2012. Works pretty fast, and supports multi-word search by using "space". So to search for LoginController, you could press Alt+O and search using "Lo Con".

https://i.stack.imgur.com/NPBBY.png

You could also use ReSharper (paid) and CodeMaid (free) to do this.


u
user2645830

Open command window( View -> Other windows -> command window - Ctrl + W, A) type >of followed by the file name. It would start showing up the list as you type.


j
jezrael

Visual Assist: link.

Install, load solution, press Shift+Alt+O, search for files in solution by substring. Try also Shift+Alt+S, for the equivalent for symbols. This addin has a bunch of completion popup and syntax colouring stuff in it that aren't to all tastes, but the code browsing features are done well and seem uncontroversial.

Judging by comments on the forums, compatibility with Resharper is something they pay attention to.

For free, try also Nifty Solution: link.

I haven't used this myself, but I use the author's Nifty Perforce plugin, and that is pretty tidy.


nifty solution is excellent. Its simple and it works. It also adds "toggle between header/source" which I like.
E
Eduardo A

You can easily call for a window called "Navigate To" with combination ctrl + ,

Or, go to Tools and then click Navigate To


On visual studio 2012 it is ->EDIT ->Navigate To or ctrl+,
C
Community

Visual Studio for Mac 2017 7.x.x

To search by File name:

⌘ + .

Ctrl + Shift + D

To search by Type name:

Ctrl + Shift + T

Your keyboard focus might have been gone to following Right side Top corner of the Visual Studio Window:

https://i.stack.imgur.com/jogW1.png


s
shiga soumya

You can press ctrl+t to get a editor Get to all , in which you can type the file name to navigate to that specific file.


C
Carloss

Is too simple by using the Windows Explorer search inside the project folder. Done.


Add an index and that's a killer solution!
This option wouldn't work for ftp sites loaded in visual studio. In vs2013 Ctrl + semi colon allows you to search the solution explorer quickly by filename without leaving the window.
I am using VS 2010 and I wanted to open all the code behind files of my User Controls (i.e .ascx.cs files). Really your solution is straight forward and useful
b/c I love bouncing between Windows Explorer and Vs.NEt , yeah right.
M
Mwiza

With Visual Studio 2017 Community edition on mac, the shortcut is:

Cmd+Shift+D: Find by file name

Cmd+Shift+T: Find by type name

To see these commands, navigate to the top menu: Search > Go To


M
Mark Hurd

In Visual Studio 2008 (and probably later), the free DevExpress CodeRush Xpress add-in supplies Ctrl+Alt+F, Quick File Navigation, which searches on an exact substring in the file name or on capital letters.

(Unrelated to this answer, but note the rather more useful, Quick Navigation, Ctrl+Shift+Q, which I would have liked to have known about before now :-) )


O
Oz Shabat

Visual Studio 2019:

Menu -> Preferences -> Key Bindings -> Navigate To...