Jordan Rieger
Jordan Rieger

Reputation: 2674

Visual Studio 2015 Find in Files not remembering file types or locations

I rely on the Find in Files dialog in Visual Studio a great deal. (Sometimes Intellisense/Resharper just don't cut it.) Since upgrading to 2015, I've noticed that the dialog doesn't remember my custom "Look in" paths or "Look at these file types" lists between sessions.

If I close my solution and VS instance, then reopen, I have to enter my custom path and file types again. Huge waste of time. Has anyone run else run into this? Any workaround? 2013 used to remember this stuff.

Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00081
Installed Version: Professional

Upvotes: 19

Views: 2269

Answers (4)

grimmdp
grimmdp

Reputation: 271

If you have an earlier version of VS, export the environment settings, copy the NumberOfScopes and NamedScopes* settings from the Environment_UnifiedFind section to the same section in your VS2015 settings file and then re-import settings.

Once I did this, it allowed VS2015 to start saving folder specifications for future settings exports.

Or you could try replacing this in your VS2015 export:

<PropertyValue name="NumberOfScopes">0</PropertyValue>

With this:

<PropertyValue name="NumberOfScopes">1</PropertyValue>
<PropertyValue name="NamedScopes&gt;0">FOLDER_SPEC_NAME&gt;SEMICOLON_SEPARATED_LIST_OF_FOLDERS&gt;{4A812F3C-7B1A-4987-9769-461F20EB25CB}</PropertyValue>

(Don't forget to re-import after you make the change)

Upvotes: 0

Zashy
Zashy

Reputation: 86

I ran into this today. After much searching I found a post on the visual studio forums somehow. This pointed me towards ReSharper. This directed me towards a workaround.

  1. Start visual studio in safe mode with the command line argument /SafeMode
  2. Create the folder sets you want for searching
  3. Restart visual studio not in safemode

Once I had restarted all my created custom searches remained, and the registry values were created. This might not work in the specific case, but this worked for me.

Upvotes: 7

Sergey Vlasov
Sergey Vlasov

Reputation: 27930

You can set these values programmatically inside Visual Studio for the Find and Replace dialog (for example with Visual Commander):

DTE.Find.FilesOfType = "*.txt";
DTE.Find.SearchPath = @"c:\temp";

Upvotes: 0

Ringil
Ringil

Reputation: 6537

I've never had any problems with it not remembering my settings, but I imagine that you could run a custom registry modifier to add the appropriate keys, you could make sure your settings are always pristine. The custom search information is stored in HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\Find.

The file types are stored in a string key called Filter with whatever you would normally input into the custom file type category in the VS search window. For example searching for only .cs and .txt files you would put *.cs;*.txt.

The folders are located in a string key called Query with values such as C:\Folder1;C:\Folder2. However, it's behavior seems a little weird. You have change the value of Query and a Query+integer value (i.e. Query0) to the same value to have it appear in Visual Studio.

If you just run a script to modify the above values to the files types/folder locations you want, that should work.

Upvotes: 8

Related Questions