简体   繁体   English

Visual Studio 2010在文件中查找 - 找不到文件!

[英]Visual Studio 2010 Find in Files - not finding files!

Please save me from going totally mad here. 请救我脱离这里疯了。 With my project, I keep finding that "Find in Files" works fine when I search on the views directory in my ASP.NET MVC project, but not when I go one level up to the project directory: 在我的项目中,我一直发现当我在ASP.NET MVC项目中的views目录中搜索时,“在文件中查找”工作正常,但是当我进入项目目录的某个级别时却没有:

----
Find all "<RelatedSections", Subfolders, Keep modified files open, Find Results 2, "C:\Users\James\Documents\Visual Studio Projects\DeveloperFusion\DeveloperFusion.Web.UI", "*.spark"
  No files were found to look in.
----

and yet when doing: 但是在做的时候:

----
Find all "<RelatedSections", Subfolders, Keep modified files open, Find Results 2, "C:\Users\James\Documents\Visual Studio Projects\DeveloperFusion\DeveloperFusion.Web.UI\Views", "*.spark"
  C:\Users\James\Documents\Visual Studio Projects\DeveloperFusion\DeveloperFusion.Web.UI\Views\Community\Index.spark(108):  <RelatedSections />
  C:\Users\James\Documents\Visual Studio Projects\DeveloperFusion\DeveloperFusion.Web.UI\Views\Content\Article\Index.spark(13):  <RelatedSections />
  C:\Users\James\Documents\Visual Studio Projects\DeveloperFusion\DeveloperFusion.Web.UI\Views\Content\Code\Index.spark(14):  <RelatedSections />
  <snip>
  Matching lines: 9    Matching files: 9    Total files searched: 239
----

As you can see, look in file types is set to *.spark (the same in both queries). 如您所见,查看文件类型设置为* .spark(两个查询中相同)。 Subfolder searching is enabled. 子文件夹搜索已启用。 The View folder isn't set to hidden or anything like that, and is included in the project. View文件夹未设置为隐藏或类似的任何内容,并包含在项目中。

I'm at a loss - any suggestions? 我不知所措 - 有什么建议吗?

Update I've now realised that this behaviour varies depending on the folder name. 更新我现在意识到此行为因文件夹名称而异。 It seems to be anything appearing alphabetically after the "obj" folder just does not get discovered. 在“obj”文件夹没有被发现之后,似乎是按字母顺序出现的任何内容。 If I delete everything (or rename) the obj folder to "xyz", then the Views folder get's searched fine. 如果我删除所有(或重命名)obj文件夹为“xyz”,那么Views文件夹可以被搜索到。 Weirdness. 怪事。 Could it have something to do with the long path names generated by the MS Deploy tool in the obj folder? 它可能与obj文件夹中的MS Deploy工具生成的长路径名有关吗?

I have seen this before, and I have found that if you press Ctrl+Break , the issue goes away. 我以前见过这个,我发现如果按Ctrl+Break ,问题就会消失。 This shows the same resolution. 显示了相同的分辨率。

By the way, before you ask: no, I do not know why this works. 顺便说一下,在你问:不,我不知道为什么会这样。

Ok, so I've tracked this down. 好的,所以我跟踪了这​​个。

Any folders that are alphabetically after the "obj" folder in the root of the project were not getting searched. 在项目根目录中的“obj”文件夹之后按字母顺序排列的任何文件夹都没有被搜索到。

Having done some digging, I seem to have ended up with this folder structure being created by the MS Deploy/Packaging tool: 完成了一些挖掘之后,我似乎最终得到了这个由MS Deploy / Packaging工具创建的文件夹结构:

C:\\Users\\James\\Documents\\Visual Studio Projects\\DeveloperFusion\\DeveloperFusion.Web.UI\\obj\\Release\\Package\\Archive\\Content\\C_C\\Users\\James\\Documents\\Visual Studio Projects\\DeveloperFusion\\DeveloperFusion.Web.UI\\obj\\Release\\Package\\PackageTmp\\Views C:\\ Users \\ James \\ Documents \\ Visual Studio Projects \\ DeveloperFusion \\ DeveloperFusion.Web.UI \\ obj \\ Release \\ Package \\ Archive \\ Content \\ C_C \\ Users \\ James \\ Documents \\ Visual Studio Projects \\ DeveloperFusion \\ DeveloperFusion.Web.UI \\ OBJ \\发布\\包\\ PackageTmp \\浏览

(and yes, that's one, somewhat recursive path!). (是的,这是一个,有点递归的路径!)。 And for some reason the "Views" folder had "lost" administrator ownership, and was being locked by Visual Studio. 由于某种原因,“Views”文件夹“丢失”了管理员所有权,并被Visual Studio锁定。 After using an unlocker tool, and deleting the Views folder, suddenly everything started working again. 使用解锁工具并删除Views文件夹后,突然一切都重新开始工作了。

Weirdness. 怪事。

Moral of the story - if anyone else is seeing this weird behaviour, Visual Studio seems to give up if it hits access denied on any folder and doesn't tell you! 故事的道德 - 如果其他任何人看到这种奇怪的行为,Visual Studio似乎放弃它是否在任何文件夹上访问被拒绝并且没有告诉你!

(posted on connect here: https://connect.microsoft.com/VisualStudio/feedback/details/640712/find-replace-in-files-silently-aborts-if-it-hits-acl-permissions-problem#details ) (发布于此处连接: https//connect.microsoft.com/VisualStudio/feedback/details/640712/find-replace-in-files-silently-aborts-if-it-hits-acl-permissions-problem#details

Visual Studio 2010 Find In Files will stop searching when the folders being searched contain sub folders with very long paths. 当搜索的文件夹包含具有很长路径的子文件夹时,Visual Studio 2010查找文件将停止搜索。

Cleaning your project outputs may fix this, especially if you're using MS Deploy which can create deeply nested folder structures. 清理项目输出可能会解决这个问题,特别是如果您正在使用可以创建深层嵌套文件夹结构的MS Deploy。

重新启动PC为我解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM