Team Foundation Server Search in Code (VB.net)

The company I’m currently working for has about 100 developers, who are committing their code to SourceSafe.

Since Visual SourceSafe (VSS) has some serious issues and is far away from bein state-of-the-art the company is now in process of testing Team Foundation Server (TFS). Our team is the test team and we have moved our source (without history) to TFS.

After some days of using the system, we were looking for the feature "Find in Files", which was used quite often in the VSS era. We installed the TFS Powertoys which gave us a "Wildcard Search". At first sight this feature looks like the good old VSS "Search in Files" but in fact this option searches only in filenames. After some googling I found this StackOverflow post of some other guy, who was looking for this feature.

For me it’s unbelievable to ship such a big product without basic functionality like "Search in Files".

There are some answers which pointed me to a cool project: CS2Search.

CS2Search lets you index your code and search with some neat queries like

interface:IFooBar

Obviously this will give you all IFooBar interfaces in your indexed repository.

CS2Search uses Lucene.net to index the code.  Since Lucene.net uses files as input, you have to setup a scheduled task or some triggers/notifications to get the latest code out of t he Source Control System.

I really like the CS2Search idea.  But It’s a pity for us, that there is no VB.net parser available out of the box, since the company develops in VB. net. But as simoneb said in this blogpost, it is possible to integrate your own parser through Windsor IoC.

Building a parser is a nice exercise and thanks to Microsoft and it’s miss ing search-feature in TFS I will dig around in this topic soon.