在 Visual Studio 中搜索时仅包含某些文件类型 [英] Include only certain file types when searching in Visual Studio
问题描述
通常,当我想在 Visual Studio 中搜索我的代码时,我知道我要查找的是一些 C# 代码.但是,由于我在 JavaScript 文件中使用了相同的变量名,因此我也必须遍历所有这些搜索结果.如果我要查找的文本也在我们引入项目的第三方 JavaScript 库中使用,则情况会变得更糟:这可能会产生数百个搜索结果.
Often when I want to search through my code in Visual Studio, I know the thing I'm looking for is in some C# code. However, as I've used the same variable name in a JavaScript file, I have to wade through all those search results too. This gets even worse when the text I'm looking for is also used in a third-party JavaScript library that we've brought into the project: this can result in hundreds of search results.
为了使事情更加复杂,我们的设计师在同一个项目中包含了页面的 HTML 模型,所以我经常发现我也在那里找到了大量的搜索结果.
To compound things, our designers include HTML mock-ups of the pages in the same project, so I often find I'm hitting loads of search results in there too.
我想我真正想要的是在我的 .cs、.aspx 和 .ascx 文件中看到结果,而不是 .js 或 .htm.
I guess what I really want is to see results in my .cs, .aspx, and .ascx files, but not .js or .htm.
有没有办法做到以下几点:
Is there any way to do any of the following:
- 仅搜索特定类型的文件(仅搜索 .cs 文件).
- 仅在任何给定类型集的文件中搜索(仅搜索 .cs、.aspx 和 .ascx 文件).
- 搜索除特定类型以外的所有文件类型(搜索除 .js 之外的所有文件).
我怀疑不是,在这种情况下,有什么巧妙的方法可以解决这个问题吗?
I suspect not, in which case is there any crafty way of working around this?
推荐答案
在在文件中查找"对话框 (Ctrl+Shift+F) 中,应该有一个名为查找选项"的字段.您应该能够在此对话框的字段中输入要搜索的字段扩展名:
In the Find in Files dialog (Ctrl+Shift+F), there should be a field called Find Options. You should be able to enter the extensions of fields you want to search in a field in this dialog:
*.cs; *.aspx; *.ascx;
这篇关于在 Visual Studio 中搜索时仅包含某些文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!