How to find text including .sln and .csproj? I wanted to search package version present in all the project. I have instance where package version is not captured in npm but is present in .csproj file and hence causes issues.
How do I search all files in Visual Studio? Search across files# VS Code allows you to quickly search over all files in the currently opened folder. Press Ctrl+Shift+F and enter your search term.
You can search across all files in the open folder with the following shortcuts. Use “Ctrl + Shift + F” for Windows and all other operating systems. For Mac, it's “Command + Shift + F”.
A file with . SLN extension represents a Visual Studio solution file that keeps information about the organization of projects in a solution file. The contents of such a solution file are written in plain text inside the file and can be observed/edited by opening the file in any text editor.
Yes, you always want to include the . sln file, it includes the links to all the projects that are in the solution. Save this answer. Show activity on this post.
In VS:
Go to Edit > Find and Replace > Find in Files, which opens this screen:
Then press the ellipsis button to the right of Look In that's circled in red above.
That opens a screen where you can select folders:
use the right arrow between the lists (circled in red) to select which folder(s) to search, choose the ones that contain the .proj or .sln files you want searched.
Press OK
Back on the Find and Replace screen you can add the filter (similar to that mentioned in the other answer) if you want just project files, e.g. .??proj;.sln;.asax;.ashx
And then finally the Find buttons will be enabled, hit Find All and that will return results that include project files:
NB: @T.S. just made the very good point that I have 'Display file names only' ticked in the screenshots. You don't need that to make this work, I had that ticked because I have minified files in my project and they cause the Find Results window to slow to a crawl if they are included in the search results!
Visual Studio has option called "Find in Files". You open the form, type your text you want to search for and you can actually set the file types. As example, if you want to search project files, solution files and code files, you can set filter as
*.??proj;*.sln;*.vb;*.cs;*.asax;*.ashx
We have mixture of c# and vb, so *.??proj
covers all of them.
Click "Find All"
When your search is over, in the result window, click on the line and it will take you to the line in file where your match is found
Important Note
When field "Look in" is set to "Entire Solution" or "Current Project" or "All open documents" search will totally skip
*.??proj
files even if they are listed in filter. If you unload the project and open project file for edit, "Entire Solution" and "All open documents" options will search through opened project file.
Also keep in mind
Bugs have been reported to MS about functionality of Find in Files. Especially VS2017 is affected. So, based on the VS version you have, something may or may not work correctly. I know that subfolders feature was affected. I've seen this searching only 3 folders deep but not deeper. Here you can look at or report new bug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With