VisualStudio

The search result window from Visual Studio is not really the best. Sometimes it can be hard to find what you’re searching for, especially when you have long file paths. Unfortunately you cannot even copy/past the results to Excel and filter/sort there.

Luckily there is a hidden Registry Key you can use to format the output on your own.

The Registry Key is in  HKCU\Software\Microsoft\VisualStudio\<your VS Version>\Find and should be named Find result format (type is string). Just create it if it doesn’t exist.

It holds a formatting string and you can use a combination of the following variables:

Value Explanation Example
 $p Path
 $f Filename
 $v drive / unc share
 $d Directory
 $n Name
 $e Extension
 $l Line
 $c Column
 $x end col if on first line, else end of first line
$L span end line
$C span end col
$0 Matched text
$t text of first line
$s summary of hit
$T Test of spanned lines
\n Newline
\s Space
\t Tab
\\ Slash
\$ $

My favorite is $p($l,$c):\t\t\t$s\r\n This one allows you to copy/paste the result to Excel for very easy further filtering and sorting (columns are detected correctly because of the tabs).

Another nice one is $f$e($l,$c):$t\r\n which just shows the file names and not the entire paths.

Sources:

Today was one of the days when I found a feature in Visual Studio which could have helped me already years ago.

If you’re working with many tabs (like for migrating something) you find yourself searching the right tab quite often. To solve this, there is a (for me unknown) setting in Visual Studio to move pinned tabs to it’s own row in the Document Well.
See the following screenshot for this setting:

Sometimes, if that is not enough, there are Add-Ins available to go further with that.
One is Productivity Power Tools which is free and enables also other possibilities for the tabs.

Then there’s also the commercial Tabs Studio which should provide pretty anything you need.

Sometimes you want to step into Source Code which comes from the core components of Microsoft. You can either decompile the .Net Libraries with .Net Reflector or ILSpy or use the Microsoft Reference Source Code Packages.

The Reference Source Code allows you to directly lookup the source or even debug into the core components of Microsoft. Just download the Packages you want, install them and you’re done. You now can Debug into (F11) the source or look it up (F12).

Alternative for Visual Studio 2010
Setting up Visual Studio 2010 to step into Microsoft .NET Source Code

Today, I tried to make a Release Build of a rather large solution and I got this exception:

Could not load file or assembly ‘file:///C:\some.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) C:\somepath\SGEN

The solution is simpler than it looks like:
The DLL was downloaded from the web and somehow, Windows “blocked”. To unblock it, just right-click the DLL in your explorer and click the “Unblock” button (make sure, you have write access to the file).
That’s all what is needed to fix this problem (at least in my case).

Code printed in Visual Studio 2010 is not colored.
To enable this “feature”, you have to install this Extension.
Be aware that you can’t collapse regions for printing with this Extension.
Furthermore, if you wan’t line numbers, you have to enable them via Tools->Options.