Erasing the Find/Replace History on Visual Studio 2010 - visual-studio-2010

I've looked around online to try to find a way to delete the history of VS 2010's Find/Replace feature, but all I've gotten are answers only valid for previous versions (VS 05, VS 08, etc.). Does anyone know how clear it for the 2010 version?
Thanks!

Open regedit.exe, go to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Find. Remove all keys that starts with Find and Replace, like Find1, Find2, Replace1, etc. You can remove history for Find only or Replace only, or remove only particular Find, if you want to.
HKEY_CURRENT_USER user is for user that is currently logged in.
If you need to clear history for another user, you need to go to HKEY_USERS\{UserId}\Software\Microsoft\VisualStudio\10.0\Find
For example HKEY_USERS\S-1-5-21-2705333110-2095705488-3072420928-1000\Software\Microsoft\VisualStudio\10.0\Find.
[EDIT]
Step-by-step:
Make a quick console application:
using Microsoft.Win32;
public static void Main()
{
var findKey = Registry.CurrentUser.OpenSubKey(#"Software\Microsoft\VisualStudio\10.0\Find", true);
findKey.GetValueNames()
.Where(arg => Regex.IsMatch(arg, #"^Find( \d+)?$"))
.ToList()
.ForEach(findKey.DeleteValue);
}
Compile it and close VS.
Run the compiled exe.
Open VS - Find history is empty.
Keep in mind that VS caches this Find and Replace lists. It persists the lists to the registry when you close VS. So if you clean the list and then restart VS, you will see no effect, because VS restored the list on the shutdown. So you need to close VS, clear the list, open VS.

My 2 cents - if all else fails, just try searching a lot of different terms yourself. There is a limit on how many searches it remembers, and eventually your own searches will push the unwanted ones off the list.

For Visual Studio 2017:
http://www.visualstudioextensibility.com/2017/07/15/about-the-new-privateregistry-bin-file-of-visual-studio-2017/
https://github.com/Microsoft/VSProjectSystem/blob/master/doc/overview/examine_registry.md
Extract:
Close Visual Studio
Start Regedit.exe
Select the HKEY_LOCAL_MACHINE node
From the main menu, select File -> Load Hive... and select the private registry file. That file is stored in the Local App Data %localappdata%\Microsoft\VisualStudio\[config]\privateregistry.bin where [config] corresponds to the configuration hive you would like to browse
It will prompt for a name - that represents the name that will be displayed under (e.g. IsolatedHive)
Now you should be able to browse the registry under the hive you created
Now search for the key "Find" and delete whatever you need to delete.
Before launching Visual Studio, you need to unload it: From the main menu File -> Unload Hive before attempting to run VS (otherwise regedit keeps the file locked, and Visual Studio will fail to launch)

Related

Switch from Compare Files in Visual Studio to normal file view

When I compare a file with its unmodified version in Visual Studio from Team Viewer, the Compare Files view is opened. The head version of the file is displayed on the left, the working copy on the right.
Is there a way (preferably a keyboard shortcut) to quickly switch from the Diff viewer to the normal file view of the working copy?
The fastest way I have found is using the following shortcut:
CTRL+', S to Sync Solution Explorer with active Document
And then simply Enter to open it.
The best I have found is to use CTRL + O, [file_name], Enter.
In my 2017 version of Visual Studio will bring up the "Open File" pop up window in the directory of the file you are currently looking at. You'll then need to retype part of the file name in order for Windows to suggest files for you to open.
I don't think it's quite what you wanted but at least you can do it without having to resort to using your mouse!
Note that you don't necessarily need to type the whole of the filename in as you can use the down key to toggle through suggestions offered.
This combination works for me:
Ctrl+Alt+L to open Solution Explorer on respective file
Enter to open the file

Visual Studio 2013 always opens Properties window in Category sorting

I am pretty sure that Microsoft changed something between Visual Studio 2010 - 2012/2013.
Whenever I open the Properties window for the first time in a Visual Studio 2013 instance, it defaults to the Category sorting rather than the Alphabetical sorting.
In 2010, I know that the sorting was stored and remembered in new instance of VS. If I used Alphabetical sorting before, it opened the Properties window in Alphabetical sorting.
In 2013 however, it always defaults to Category. This is really annoying as my eyes are unused to find Properties in the long list of a Windows.Forms control properties for example.
Can anyone reproduce this issue and may even have a fix for this?
Something is broken on your machine if this does not persist between VS sessions. Always hard to guess what that might be, you'll need to look for the reason that the current settings are not getting saved on your machine. There is one specific file that gets updated every time you exit VS, it records the value that you care about.
You'll find it in C:\Users\YourName\Documents\Visual Studio 2013\Settings\CurrentSettings.vssettings. Pay attention to the time stamp of the file to ensure it is getting written. Use SysInternals' Process Monitor if necessary to find out why the write is failing. Or suspect a troublesome add-in that does not let VS shutdown properly.
If absolutely necessary, you can edit the file yourself. Copy it to an .xml file so it is easy to reformat with Edit + Advanced + Format Document. The relevant entry looks like this (edited to fit):
<Category name="Environment_PropertiesWindow"
Category="{731a3cc7-de5e-49ca-9115-9a03e46624b0}"
Package="{7494682b-37a0-11d2-a273-00c04f8ef4ff}"
RegisteredName="Environment_PropertiesWindow"
PackageName="Windows Forms Designer Package">
<PropertyValue name="PbrsAlpha">1</PropertyValue>
<PropertyValue name="PbrsShowDesc">1</PropertyValue>
</Category>
The "PbrsAlpha" property value determines the sorting, it is 1 for alphabetical sort, 0 for category sort.
I did the same thing and saved settings file by changing PbrsAlpha value to "1" but the file will reset itself after restarting Visual Studio.
I found this solution:
Tools -> Import and Export Settings... -> Reset All Settings -> Save my current settings ( in case of a bad scenario) -> Finish

How can I save opened tabs and tab groups in Visual Studio 2012?

I need to have different set of open tabs and tab groups for each of my tasks.
Import and export setting not helping me to do this, neither does this SO question that has been asked similarly but for windows/tools layout - i.e. NOT for the tabs/tab-groups.
How can I save and restore the saved set?
Late to the party here but it popped up pretty high in my google search for this kind of thing so I'll drop my find: Save All The Tabs.
One Marketplace Extension that works with Visual Studio 2013, 2015, 2017 and 2019 is the Workspace Manager.
One additional tip: after installing it and adding the toolbar, you might have to restart VS again until it fully works (see Q & A). At least I had to do so in VS 2019 (16.1.3).
You can save open documents and later reopen them as a group with the Favorite Documents extension.
Really late to the party but ContextKeeper plugin will do the job. Supports VS 2022/2019/2017/2015/2013.
It's an extension to quickly save and restore sets of document tabs and its metadata. The "session", similar to Vim's :mksession command, is defined as:
last opened/favorites files
documents (tabs with code) positions, state and order
tabs groups (including horizontal/vertical orientation)
remembers line&column for every opened tab
It also has a powerful git integration - automatically saves and restores context when switching between branches.
All contexts are saved to simple JSON files.
If you accidentally came here looking for a VS Code solution, from the same author of Save All The Tabs (for Visual Studio) that MushKov shared in this answer:
Restore Editors extension
press Ctrl/Cmd+K and Ctrl/Cmd+E to access the editors/tab menu

In Visual Studio when viewing a changeset, how can I change the view of cs files?

In Visual Studio with TFS as source control, when I view the history and double click a cs file, the file is loaded in notepad. How can i change the application to be notepad++?
I also would like the OS's default application for the file to still be visual studio
After pouring over ProcessMonitor logs I think I found the solution!
You need to change the what the Windows shell (explorer) thinks the "Edit" action for text files. I was able to change this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\text\shell\edit\command
to something other than Notepad (in my case notepad2). Now Visual Studio's TFS's changeset dialog opens cs files with that editor.
This will probably change the edit option for not just cs files, but everything considered "text'. The registry entries for file associations are pretty complicated. I suspect that it would be possible to disassociate .cs files from this common "text" category and make this change only for cs files (but I'm not that ambitious). Also, I wouldn't be surprised if people's file associations / shell commands (open, edit, etc...) vary from machine to machine (OS versions, tools installed, etc) - so YMMV.
The only way I found is to replace notepad with notepad++. This article describes how to do it. Don't forget to check the comments to get a link to the "little exe" that comes with notepad++.
Works like a charm on W7 x64.
Cheers,
Phil
\I was able to configure this by adding new value to the registry.
OS: Windows 7 Enterprise x64
Steps on how to do it.
Run: Regedit (alt + r, type regedit)
Look for HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations
Right click "SystemFileAssociation" -> add new key then name it as .cs
Right click .cs and add new key then name it as shell
Right click shell and add new keys name it as edit and open 6
Right click edit and add new key command then change the default value to point to the file exe you want it to run.
ex: C:\Program Files (x86)\Notepad++\notepad++.exe %1
Don't forget to add the %1 at the end of the .exe
do the same for open
Hope it helps.
I don't see any options in Visual Studio for changing that, so I'm guessing it uses the system's default text editor.
Try assigning Notepad++ as the default handler for *.cs files.
You can do this from withing Notepad++ by going to Settings/Preference/File Association.
You can also do it by right-clicking on a .cs file in explorer, go to Open With/Choose Program..., then select Notepad++ and check the "Always use the selected program to open this kind of file" box before hitting OK.
The only thing that works for me is when I set the default program for the particular file type in Windows Explorer to open with the VS IDE:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe
This opens the code in a new instance of VS. Not ideal, but at least it's easier to read.

Plugin for Visual Studio to Mimic Eclipse's "Open Type" or "Open Resource" Keyboard Access

If you've ever used Eclipse, you've probably noticed the great keyboard shortcuts that let you hit a shortcut key combination, then just type the first few characters of a function, class, filename, etc. It's even smart enough to put open files first in the list.
I'm looking for a similar functionality for Visual Studio 2008. I know there's a findfiles plugin on codeproject, but that one is buggy and a little weird, and doesn't give me access to functions or classes.
Vs11 (maybe 2010 had it too) has the Navigate To... functionality which (on my machine) has the Ctrl+, shortcut.
By the way it understands capitals as camelcase-shortucts (eclipse does so too). For instance type HH to get HtmlHelper.
This isn't exactly the same as Eclipse from your description, but Visual Studio has some similar features out of the box (I've never used Visual Assist X, but it does sound interesting).
The Find ComboBox in the toolbar ends up being a sort of "Visual Studio command line". You can press Ctrl+/ (by default) to set focus there, and Visual Studio will insert an ">" at the beginning of the text (indicating that you want to enter a command instead of search). It even auto-completes as you type, helping you to find commands.
Anyway, to open a file from there, type "open <filename>". It will display any matching files in the drop down as you type (it pulls the list of files from the currently open solution).
To quickly navigate to a function, in the code editor press Ctrl+I to start an incremental search. Then just start typing until you find what you are looking for. Press Escape to cancel the search, or F3 to search again using the same query. As you are typing in the search query, the status bar in the lower left corner will contain what Visual Studio is searching for. Granted, this won't search across multiple files (I've never used Eclipse much, but that sounds like what it does from your description), but hopefully it will help you at least a little bit.
If anyone stumbles upon this thread:
There's a free plugin (created by me) for Visual Studio 2008 that mimics the Eclipse Ctrl+Shift+R Open Resource dialog (note, not the Open Type dialog). It works with any language and/or project type.
You can find it at Visual Studio Gallery.
Some of the neat features are available in Visual Assist X, though not all of them. I've asked on their forums, but they haven't appeared as yet. VAX gets updated regularly on a rough 4 week period for bug fixes and a new feature every couple of months.
If you are looking for an add-in like this to quickly navigate to source files in your project:
try the Visual Studio 2005/2008 add-in SonicFileFinder.
Resharper does this with the Ctrl-N keyword. Unfortunately it doesn't come for free.
Visual Studio doesn't have anything like this feature beyond Find.
Found this thread while searching for Eclipse's Ctrl+Shift+R, and after seeing the Visual Studio Gallery, found the DPack Tools (they are free, and no, I'm not endorsed in any way by them).
But it's exactly what I was searching:
- Alt+U -> File Browser (a la Eclipse Ctrl+Shift+R)
- Alt+M -> Code Browser (Method list in the actual class)
It has more features, but I'm happy with these ones.
I have been using biterScripting along with Visual Studio to do more flexible searching and manipulation.
It can search the entire workspace.
It can search within any project - EVEN IF THAT PROJECT IS NOT LOADED OR EVEN PART OF A WORKSPACE.
It can find things using regular expressions.
AND, ABOVE ALL, it can make bulk changes. For example, want to change the name of a class from CCustomer to CUser, I can do it in just a few command lines - Actually, I have written scripts for things like this I do often. I DON'T HAVE TO CLICK ON EACH INSTANCE AND MANUALLY DO THE CHANGE.
And, it is inexpensive ($0). I downloaded it from http://www.biterscripting.com .
I'm also comming from the Java Development side and was looking for the CTRL+T feature in the Visual Studio. The other answers refer to open file, but since in C# the class name and file name can be different this is not what i was looking for.
With the Class View or the Object Browser you can search for Objects and Classes
[View]->[Class View] or [View]->[Object]

Resources