开发者

Visual Studio 2010 Find in Files - not finding files!

开发者 https://www.devze.com 2023-02-06 10:57 出处:网络
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 leve

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:

----
Find all "<RelatedSections", Subfolders, Keep modified files open, Find Results 2, "C:\Users\James\Documents\Visual Studio Projects\DeveloperFusion\DeveloperFusion.Web.UI", "*.spark"
 开发者_StackOverflow社区 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). Subfolder searching is enabled. The View folder isn't set to hidden or anything like that, and is included in the project.

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. If I delete everything (or rename) the obj folder to "xyz", then the Views folder get's searched fine. Weirdness. Could it have something to do with the long path names generated by the MS Deploy tool in the obj folder?


I have seen this before, and I have found that if you press Ctrl+Break, the issue goes away. 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.

Having done some digging, I seem to have ended up with this folder structure being created by the MS Deploy/Packaging tool:

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

(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. After using an unlocker tool, and deleting the Views folder, suddenly everything started working again.

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!

(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)


Restarting the PC fixed this issue for me.


Visual Studio 2010 Find In Files will stop searching when the folders being searched contain sub folders with very long paths.

Cleaning your project outputs may fix this, especially if you're using MS Deploy which can create deeply nested folder structures.

0

精彩评论

暂无评论...
验证码 换一张
取 消