Wednesday, June 29, 2011

Exclude folders (.hg / .git) from Visual Studio search

When doing a find in files in a source controlled project in Visual Studio, the source control folder i.e. .hg (Mecurial) / .git (git) will appear in the search results (which is not what you want!)

hg folder in visual studio

You can hide folders in Visual Studio in two different ways:

For websites i.e. "open website" style projects

Simply browse to the folder in windows explorer and mark the folder as hidden in the folder properties.

set the folder as hidden in the folder properties via windows explorer

You may need to refresh the solution explore in Visual Studio to see the change.

the folder should now be hidden

This has been tested in Visual Studio 2008 and 2010 and is useful for hiding .git and .hg folder, but can be used to hide any folder.

For other projects type in visual studio (class library, web application etc). you can simply right click on the folder in the solution explorer and click exclude.

No comments: